Skip to content

Commit 7416546

Browse files
committed
Add workflow for distribution
1 parent fdccf87 commit 7416546

File tree

3 files changed

+92
-3
lines changed

3 files changed

+92
-3
lines changed

Diff for: .github/workflows/distribute.yml

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
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"

Diff for: .github/workflows/unit-tests.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ jobs:
1010
name: Test Networking
1111
runs-on: macos-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- name: Checkout
14+
uses: actions/checkout@v2
1415
- name: Configure Xcode
1516
run: sudo xcode-select -s "/Applications/Xcode_13.2.1.app"
1617
- name: Build

Diff for: Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@ prefix ?= /usr/local
22
bindir = $(prefix)/bin
33

44
build:
5-
swift build --configuration release
5+
swift build --configuration release --triple arm64-apple-macosx
6+
swift build --configuration release --triple x86_64-apple-macosx
7+
lipo -create -output .build/ipatool .build/arm64-apple-macosx/release/ipatool .build/x86_64-apple-macosx/release/ipatool
68

79
install: build
810
install -d "$(bindir)"
9-
install ".build/release/ipatool" "$(bindir)"
11+
install ".build/ipatool" "$(bindir)"
1012

1113
uninstall:
1214
rm -rf "$(bindir)/ipatool"

0 commit comments

Comments
 (0)