Skip to content

Commit 6356b52

Browse files
committed
Update release workflow
1 parent a2cb7c6 commit 6356b52

File tree

1 file changed

+118
-29
lines changed

1 file changed

+118
-29
lines changed

.github/workflows/release.yml

+118-29
Original file line numberDiff line numberDiff line change
@@ -29,67 +29,156 @@ jobs:
2929
name: Build
3030
runs-on: macos-latest
3131
needs: [get_version, test]
32-
strategy:
33-
fail-fast: false
34-
matrix:
35-
os: [ darwin, linux, windows ]
36-
arch: [ arm64, amd64 ]
3732
steps:
3833
- uses: actions/checkout@v2
3934
- uses: actions/setup-go@v3
4035
with:
4136
go-version: '1.19.3'
4237
cache: true
4338
- run: ./tools/version.sh
44-
- run: go build -o ipatool-${{ needs.get_version.outputs.version }}-${GOOS//darwin/macos}-$GOARCH
39+
- run: go build -o ipatool-${{ needs.get_version.outputs.version }}-windows-arm64
40+
env:
41+
GOOS: windows
42+
GOARCH: arm64
43+
- run: go build -o ipatool-${{ needs.get_version.outputs.version }}-windows-amd64
44+
env:
45+
GOOS: windows
46+
GOARCH: amd64
47+
- run: go build -o ipatool-${{ needs.get_version.outputs.version }}-linux-arm64
4548
env:
46-
GOOS: ${{ matrix.os }}
47-
GOARCH: ${{ matrix.arch }}
49+
GOOS: linux
50+
GOARCH: arm64
51+
- run: go build -o ipatool-${{ needs.get_version.outputs.version }}-linux-amd64
52+
env:
53+
GOOS: linux
54+
GOARCH: amd64
55+
- run: go build -o ipatool-${{ needs.get_version.outputs.version }}-macos-arm64
56+
env:
57+
GOOS: darwin
58+
GOARCH: arm64
4859
CGO_CFLAGS: -mmacosx-version-min=10.15
4960
CGO_LDFLAGS: -mmacosx-version-min=10.15
50-
- id: output
51-
run: echo ::set-output name=file::ipatool-${{ needs.get_version.outputs.version }}-${GOOS//darwin/macos}-$GOARCH
61+
CGO_ENABLED: 1
62+
- run: go build -o ipatool-${{ needs.get_version.outputs.version }}-macos-amd64
5263
env:
53-
GOOS: ${{ matrix.os }}
54-
GOARCH: ${{ matrix.arch }}
64+
GOOS: darwin
65+
GOARCH: amd64
66+
CGO_CFLAGS: -mmacosx-version-min=10.15
67+
CGO_LDFLAGS: -mmacosx-version-min=10.15
68+
CGO_ENABLED: 1
69+
- uses: actions/upload-artifact@v2
70+
with:
71+
name: ipatool-${{ needs.get_version.outputs.version }}-windows-arm64
72+
path: ipatool-${{ needs.get_version.outputs.version }}-windows-arm64
73+
if-no-files-found: error
74+
- uses: actions/upload-artifact@v2
75+
with:
76+
name: ipatool-${{ needs.get_version.outputs.version }}-windows-amd64
77+
path: ipatool-${{ needs.get_version.outputs.version }}-windows-amd64
78+
if-no-files-found: error
79+
- uses: actions/upload-artifact@v2
80+
with:
81+
name: ipatool-${{ needs.get_version.outputs.version }}-linux-arm64
82+
path: ipatool-${{ needs.get_version.outputs.version }}-linux-arm64
83+
if-no-files-found: error
84+
- uses: actions/upload-artifact@v2
85+
with:
86+
name: ipatool-${{ needs.get_version.outputs.version }}-linux-amd64
87+
path: ipatool-${{ needs.get_version.outputs.version }}-linux-amd64
88+
if-no-files-found: error
5589
- uses: actions/upload-artifact@v2
5690
with:
57-
name: ${{ steps.output.outputs.file }}
58-
path: ${{ steps.output.outputs.file }}
91+
name: ipatool-${{ needs.get_version.outputs.version }}-macos-arm64
92+
path: ipatool-${{ needs.get_version.outputs.version }}-macos-arm64
5993
if-no-files-found: error
60-
release:
61-
name: Release
94+
- uses: actions/upload-artifact@v2
95+
with:
96+
name: ipatool-${{ needs.get_version.outputs.version }}-macos-amd64
97+
path: ipatool-${{ needs.get_version.outputs.version }}-macos-amd64
98+
if-no-files-found: error
99+
release_windows_linux:
100+
name: Release (Windows & Linux)
62101
runs-on: ubuntu-latest
63102
needs: [get_version, build]
64103
strategy:
65104
fail-fast: false
66105
matrix:
67-
os: [ darwin, linux, windows ]
106+
os: [ linux, windows ]
68107
arch: [ arm64, amd64 ]
69108
steps:
70109
- uses: actions/checkout@v2
71-
- id: output
72-
run: echo ::set-output name=file::ipatool-${{ needs.get_version.outputs.version }}-${GOOS//darwin/macos}-$GOARCH
73-
env:
74-
GOOS: ${{ matrix.os }}
75-
GOARCH: ${{ matrix.arch }}
76110
- uses: actions/download-artifact@v2
77111
with:
78-
name: ${{ steps.output.outputs.file }}
112+
name: ipatool-${{ needs.get_version.outputs.version }}-${{ matrix.os }}-${{ matrix.arch }}
79113
path: bin
80-
- run: tar -czvf ${{ steps.output.outputs.file }}.tar.gz bin/${{ steps.output.outputs.file }}
81-
- run: ./tools/sha256sum.sh ${{ steps.output.outputs.file }}.tar.gz > ${{ steps.output.outputs.file }}.tar.gz.sha256sum
114+
- run: tar -czvf $BIN.tar.gz bin/$BIN
115+
env:
116+
BIN: ipatool-${{ needs.get_version.outputs.version }}-${{ matrix.os }}-${{ matrix.arch }}
82117
- uses: svenstaro/upload-release-action@v2
83118
with:
84119
repo_token: ${{ secrets.GITHUB_TOKEN }}
85-
file: ${{ steps.output.outputs.file }}.tar.gz
86-
asset_name: ${{ steps.output.outputs.file }}.tar.gz
120+
file: ipatool-${{ needs.get_version.outputs.version }}-${{ matrix.os }}-${{ matrix.arch }}.*
87121
tag: ${{ github.ref }}
88122
overwrite: false
123+
file_glob: true
124+
release_macos:
125+
name: Release (macOS)
126+
runs-on: ubuntu-latest
127+
needs: [get_version, build, release_windows_linux]
128+
steps:
129+
- uses: actions/checkout@v2
130+
- uses: actions/download-artifact@v2
131+
with:
132+
name: ipatool-${{ needs.get_version.outputs.version }}-macos-arm64
133+
path: bin
134+
- run: tar -czvf $BIN.tar.gz bin/$BIN && rm -rf bin/
135+
env:
136+
BIN: ipatool-${{ needs.get_version.outputs.version }}-macos-arm64
137+
- uses: actions/download-artifact@v2
138+
with:
139+
name: ipatool-${{ needs.get_version.outputs.version }}-macos-amd64
140+
path: bin
141+
- run: tar -czvf $BIN.tar.gz bin/$BIN && rm -rf bin/
142+
env:
143+
BIN: ipatool-${{ needs.get_version.outputs.version }}-macos-amd64
144+
- id: sha256
145+
run: |
146+
SHA256_ARM64=$(./tools/sha256sum.sh ipatool-${{ needs.get_version.outputs.version }}-macos-arm64.tar.gz)
147+
SHA256_AMD64=$(./tools/sha256sum.sh ipatool-${{ needs.get_version.outputs.version }}-macos-amd64.tar.gz)
148+
echo $SHA256_ARM64 > ipatool-${{ needs.get_version.outputs.version }}-macos-arm64.tar.gz.sha256sum
149+
echo $SHA256_AMD64 > ipatool-${{ needs.get_version.outputs.version }}-macos-amd64.tar.gz.sha256sum
150+
echo ::set-output name=sha256_arm64::$SHA256_ARM64
151+
echo ::set-output name=sha256_amd64::$SHA256_AMD64
89152
- uses: svenstaro/upload-release-action@v2
90153
with:
91154
repo_token: ${{ secrets.GITHUB_TOKEN }}
92-
file: ${{ steps.output.outputs.file }}.tar.gz.sha256sum
93-
asset_name: ${{ steps.output.outputs.file }}.tar.gz.sha256sum
155+
file: ipatool-${{ needs.get_version.outputs.version }}-macos-*
94156
tag: ${{ github.ref }}
95157
overwrite: false
158+
file_glob: true
159+
outputs:
160+
sha256_arm64: ${{ steps.sha256.outputs.sha256_arm64 }}
161+
sha256_amd64: ${{ steps.sha256.outputs.sha256_amd64 }}
162+
update_cask:
163+
name: Update cask
164+
runs-on: ubuntu-latest
165+
needs: [get_version, release_macos]
166+
steps:
167+
- uses: actions/checkout@v2
168+
with:
169+
repository: ${{ secrets.HOMEBREW_REPO }}
170+
ref: main
171+
token: ${{ secrets.GH_TOKEN }}
172+
- run: |
173+
sed -i "3s/.*/ sha256 \"${{ needs.release_macos.outputs.sha256_arm64 }}\"/" Casks/ipatool.rb
174+
sed -i "4s/.*/ url \"https:\/\/github.com\/majd\/ipatool\/releases\/download\/v${{ needs.get_version.outputs.version }}\/ipatool-${{ needs.get_version.outputs.version }}-macos-arm64.tar.gz\"/" Casks/ipatool.rb
175+
sed -i "5s/.*/ binary \"bin\/ipatool-${{ needs.get_version.outputs.version }}-macos-arm64\", target: \"ipatool\"/" Casks/ipatool.rb
176+
sed -i "7s/.*/ sha256 \"${{ needs.release_macos.outputs.sha256_amd64 }}\"/" Casks/ipatool.rb
177+
sed -i "8s/.*/ url \"https:\/\/github.com\/majd\/ipatool\/releases\/download\/v${{ needs.get_version.outputs.version }}\/ipatool-${{ needs.get_version.outputs.version }}-macos-amd64.tar.gz\"/" Casks/ipatool.rb
178+
sed -i "9s/.*/ binary \"bin\/ipatool-${{ needs.get_version.outputs.version }}-macos-amd64\", target: \"ipatool\"/" Casks/ipatool.rb
179+
sed -i "12s/.*/ version \"${{ needs.get_version.outputs.version }}\"/" Casks/ipatool.rb
180+
git config --local user.name ${{ secrets.GH_NAME }}
181+
git config --local user.email ${{ secrets.GH_EMAIL }}
182+
git add Casks/ipatool.rb
183+
git commit -m "Update ipatool to v${{ needs.get_version.outputs.version }}"
184+
git push "https://${{ secrets.GH_TOKEN }}@github.com/${{ secrets.HOMEBREW_REPO }}.git" --set-upstream "main"

0 commit comments

Comments
 (0)