forked from jacobdeichert/mask
-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (176 loc) · 6.88 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: New Release
on:
release:
types: [released]
permissions:
contents: write
jobs:
release-crate-mask:
if: ${{ startsWith(github.ref_name, 'mask/') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Publish crate"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p mask
release-crate-mask-parser:
if: ${{ startsWith(github.ref_name, 'mask-parser/') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Publish crate"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish -p mask-parser
release-linux:
if: ${{ startsWith(github.ref_name, 'mask/') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch dependencies
run: cargo fetch
- name: Build in release mode
run: cargo build --release --frozen --target x86_64-unknown-linux-gnu
- name: Add the version tag to the binary name
run: |
VERSION_TAG="$(echo ${{ github.ref_name }} | cut -d/ -f2)"
TARGET=x86_64-unknown-linux-gnu
NAME=mask-$VERSION_TAG-$TARGET
mkdir $NAME
mv ./target/$TARGET/release/mask ./$NAME/mask
chmod +x ./$NAME/mask
zip -r $NAME.zip $NAME
shasum -a 256 $NAME.zip > $NAME.zip.sha256
# TODO: replace with https://cli.github.com/manual/gh_release_upload
- name: Attach the binary to the release
uses: ./.github/actions/attach-release-assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
assets: ./*.zip ./*.sha256
release-linux-musl:
if: ${{ startsWith(github.ref_name, 'mask/') }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Fetch dependencies
run: cargo fetch
- name: Build in release mode
run: |
rustup target add x86_64-unknown-linux-musl
cargo build --release --frozen --target x86_64-unknown-linux-musl
- name: Add the version tag to the binary name
run: |
VERSION_TAG="$(echo ${{ github.ref_name }} | cut -d/ -f2)"
TARGET=x86_64-unknown-linux-musl
NAME=mask-$VERSION_TAG-$TARGET
mkdir $NAME
mv ./target/$TARGET/release/mask ./$NAME/mask
chmod +x ./$NAME/mask
zip -r $NAME.zip $NAME
shasum -a 256 $NAME.zip > $NAME.zip.sha256
# TODO: replace with https://cli.github.com/manual/gh_release_upload
- name: Attach the binary to the release
uses: ./.github/actions/attach-release-assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
assets: ./*.zip ./*.sha256
release-macos-aarch64:
if: ${{ startsWith(github.ref_name, 'mask/') }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Fetch dependencies
run: cargo fetch
- name: Build in release mode
run: |
SDKROOT=$(xcrun -sdk macosx --show-sdk-path)
MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)
rustup target add aarch64-apple-darwin
cargo build --release --frozen --target aarch64-apple-darwin
- name: Add the version tag to the binary name
run: |
VERSION_TAG="$(echo ${{ github.ref_name }} | cut -d/ -f2)"
TARGET=aarch64-apple-darwin
NAME=mask-$VERSION_TAG-$TARGET
mkdir $NAME
mv ./target/$TARGET/release/mask ./$NAME/mask
chmod +x ./$NAME/mask
zip -r $NAME.zip $NAME
shasum -a 256 $NAME.zip > $NAME.zip.sha256
# TODO: replace with https://cli.github.com/manual/gh_release_upload
# NOTE: cannot use the attach-release-assets action because macOS doesn't support docker-based actions.
# Luckily we can just run the bash script directly.
- name: Attach the binary to the release
run: ./.github/actions/attach-release-assets/run.sh "./*.zip ./*.sha256"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-macos-x86-64:
if: ${{ startsWith(github.ref_name, 'mask/') }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Fetch dependencies
run: cargo fetch
- name: Build in release mode
run: |
rustup target add x86_64-apple-darwin
cargo build --release --frozen --target x86_64-apple-darwin
- name: Add the version tag to the binary name
run: |
VERSION_TAG="$(echo ${{ github.ref_name }} | cut -d/ -f2)"
TARGET=x86_64-apple-darwin
NAME=mask-$VERSION_TAG-$TARGET
mkdir $NAME
mv ./target/$TARGET/release/mask ./$NAME/mask
chmod +x ./$NAME/mask
zip -r $NAME.zip $NAME
shasum -a 256 $NAME.zip > $NAME.zip.sha256
# TODO: replace with https://cli.github.com/manual/gh_release_upload
# NOTE: cannot use the attach-release-assets action because macOS doesn't support docker-based actions.
# Luckily we can just run the bash script directly.
- name: Attach the binary to the release
run: ./.github/actions/attach-release-assets/run.sh "./*.zip ./*.sha256"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release-homebrew:
if: ${{ startsWith(github.ref_name, 'mask/') }}
needs: release-macos-x86-64
runs-on: ubuntu-latest
steps:
- name: Bump homebrew-core formula
uses: mislav/bump-homebrew-formula-action@v3
env:
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
with:
# Sends a PR to homebrew-core to update the formula
formula-name: mask
release-windows:
if: ${{ startsWith(github.ref_name, 'mask/') }}
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Fetch dependencies
run: cargo fetch
- name: Build in release mode
run: cargo build --release --frozen --target x86_64-pc-windows-msvc
- name: Add the version tag to the binary name
shell: bash
run: |
VERSION_TAG="$(echo ${{ github.ref_name }} | cut -d/ -f2)"
TARGET=x86_64-pc-windows-msvc
NAME=mask-$VERSION_TAG-$TARGET
mkdir $NAME
mv ./target/$TARGET/release/mask.exe ./$NAME/mask.exe
7z a $NAME.zip $NAME
certutil -hashfile $NAME.zip sha256 | grep -E [A-Fa-f0-9]{64} > $NAME.zip.sha256
# TODO: replace with https://cli.github.com/manual/gh_release_upload
# NOTE: cannot use the attach-release-assets action because windows doesn't support docker-based actions.
# Luckily we can just run the bash script directly.
- name: Attach the binary to the release
shell: bash
run: ./.github/actions/attach-release-assets/run.sh "./*.zip ./*.sha256"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}