1
+ name : Distribute
2
+
3
+ on :
4
+ push :
5
+ tags :
6
+ - " v*"
7
+
8
+ jobs :
9
+ get_version :
10
+ name : Get version
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - name : Set output
14
+ id : set_output
15
+ run : echo ::set-output name=version::${GITHUB_REF#refs/tags/v}
16
+ outputs :
17
+ version : ${{ steps.set_output.outputs.version }}
18
+ test :
19
+ name : Run tests
20
+ runs-on : macos-latest
21
+ steps :
22
+ - name : Checkout
23
+ uses : actions/checkout@v2
24
+ - name : Configure Xcode
25
+ run : sudo xcode-select -s "/Applications/Xcode_13.2.1.app"
26
+ - name : Build
27
+ run : swift build
28
+ - name : Run tests
29
+ run : swift test
30
+ build :
31
+ name : Build
32
+ runs-on : macos-latest
33
+ needs : [get_version, test]
34
+ steps :
35
+ - name : Checkout
36
+ uses : actions/checkout@v2
37
+ - name : Configure Xcode
38
+ run : sudo xcode-select -s "/Applications/Xcode_13.2.1.app"
39
+ - name : Build
40
+ run : make build
41
+ - name : Upload binary
42
+ uses : actions/upload-artifact@v2
43
+ with :
44
+ name : ipatool-v${{ needs.get_version.outputs.version }}
45
+ path : .build/ipatool
46
+ if-no-files-found : error
47
+ distribute :
48
+ name : Distribute
49
+ runs-on : ubuntu-latest
50
+ needs : [get_version, build]
51
+ steps :
52
+ - name : Download binary
53
+ uses : actions/download-artifact@v2
54
+ with :
55
+ name : ipatool-v${{ needs.get_version.outputs.version }}
56
+ path : ipatool-v${{ needs.get_version.outputs.version }}
57
+ - name : Archive binary
58
+ run : |
59
+ mv ipatool-v${{ needs.get_version.outputs.version }}/ipatool ipatool
60
+ zip ipatool-v${{ needs.get_version.outputs.version }}.zip ipatool
61
+ - name : Upload binary to release
62
+ uses : svenstaro/upload-release-action@v2
63
+ with :
64
+ repo_token : ${{ secrets.GITHUB_TOKEN }}
65
+ file : ipatool-v${{ needs.get_version.outputs.version }}.zip
66
+ asset_name : ipatool-v${{ needs.get_version.outputs.version }}.zip
67
+ tag : ${{ github.ref }}
68
+ overwrite : false
69
+ - name : Checkout homebrew repo
70
+ uses : actions/checkout@v2
71
+ with :
72
+ repository : ${{ secrets.HOMEBREW_REPO }}
73
+ path : repo
74
+ ref : main
75
+ token : ${{ secrets.GH_TOKEN }}
76
+ - name : Update homebrew repo
77
+ run : |
78
+ SHA256=$(sha256sum ipatool-v${{ needs.get_version.outputs.version }}.zip | awk '{print $1}')
79
+ cd repo
80
+ sed -i "3s/.*/ sha256 \"$SHA256\"/" Casks/ipatool.rb
81
+ sed -i "2s/.*/ version \"${{ needs.get_version.outputs.version }}\"/" Casks/ipatool.rb
82
+ git config --local user.name ${{ secrets.GH_NAME }}
83
+ git config --local user.email ${{ secrets.GH_EMAIL }}
84
+ git add Casks/ipatool.rb
85
+ git commit -m "Update ipatool to v${{ needs.get_version.outputs.version }}"
86
+ git push "https://${{ secrets.GH_TOKEN }}@github.com/${{ secrets.HOMEBREW_REPO }}.git" --set-upstream "main"
0 commit comments