Repository navigation
266 lines (233 loc) · 8.99 KB
/
Copy pathdev-release.yml
File metadata and controls
266 lines (233 loc) · 8.99 KB
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
name: Dev Release
on:
workflow_dispatch:
permissions:
contents: write
concurrency:
# One group for all commits: concurrent runs could publish latest-dev.json out of order.
group: dev-release
cancel-in-progress: false
jobs:
create-release:
name: Create draft prerelease
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.release.outputs.release_id }}
tag: ${{ steps.release.outputs.tag }}
version: ${{ steps.release.outputs.version }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
- name: Create or find draft prerelease
id: release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: cargo x create-release --dev
build:
name: Build (${{ matrix.name }})
needs: create-release
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
# RELEASE_TARGETS: update when adding a release target.
matrix:
include:
- name: Linux x86_64
os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
xtask: ./target/debug/xtask
- name: macOS aarch64
os: macos-latest
target: aarch64-apple-darwin
xtask: ./target/debug/xtask
apple_sign: true
- name: macOS x86_64
os: macos-latest
target: x86_64-apple-darwin
xtask: ./target/debug/xtask
apple_sign: true
- name: Windows x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
xtask: ./target/debug/xtask.exe
- name: Windows aarch64
os: windows-latest
target: aarch64-pc-windows-msvc
xtask: ./target/debug/xtask.exe
steps:
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install --yes \
libappindicator3-dev \
librsvg2-dev \
libwebkit2gtk-4.1-dev \
patchelf
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
with:
target: ${{ matrix.target }}
cache-key: release-${{ matrix.target }}
- name: Build release tool
run: cargo build --locked --package xtask
- name: Install Node.js
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
cache: npm
cache-dependency-path: crates/wizard-gui/wizard-ui/package-lock.json
- name: Install frontend dependencies
working-directory: crates/wizard-gui/wizard-ui
run: npm ci
- name: Build and stage prerelease bundles
shell: bash
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.DEV_TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.DEV_TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
# Apple credentials are exposed only to targets that use Apple signing.
APPLE_TEAM_ID: ${{ matrix.apple_sign && secrets.APPLE_TEAM_ID || '' }}
APPLE_DEVELOPER_ID_CERT_P12: ${{ matrix.apple_sign && secrets.APPLE_DEVELOPER_ID_CERT_P12 || '' }}
APPLE_DEVELOPER_ID_CERT_PASSWORD: ${{ matrix.apple_sign && secrets.APPLE_DEVELOPER_ID_CERT_PASSWORD || '' }}
APPLE_NOTARY_API_ISSUER_ID: ${{ matrix.apple_sign && secrets.APPLE_NOTARY_API_ISSUER_ID || '' }}
APPLE_NOTARY_API_KEY: ${{ matrix.apple_sign && secrets.APPLE_NOTARY_API_KEY || '' }}
APPLE_NOTARY_API_KEY_ID: ${{ matrix.apple_sign && secrets.APPLE_NOTARY_API_KEY_ID || '' }}
run: >-
"${{ matrix.xtask }}" release-build --dev
${{ matrix.apple_sign && '--notarize-dir notarize' || '' }}
--version ${{ needs.create-release.outputs.version }}
--target ${{ matrix.target }}
--output release-assets
- name: Upload prerelease bundles
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ needs.create-release.outputs.tag }}
run: >-
gh release upload "$RELEASE_TAG" release-assets/*
--clobber
# The disk image goes to the release only after the notarize job staples it.
- name: Keep submitted disk image and notarization submission ID
if: matrix.apple_sign
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: notarize-${{ matrix.target }}
path: notarize
if-no-files-found: error
# A re-run build submits a new disk image.
overwrite: true
notarize:
name: Notarize (${{ matrix.name }})
needs:
- create-release
- build
runs-on: macos-latest
# Apple usually finishes in minutes but sometimes takes hours. When this job times
# out, re-run it: it keeps waiting for the same submission instead of rebuilding.
timeout-minutes: 180
strategy:
fail-fast: false
# RELEASE_TARGETS: update when adding a macOS release target.
matrix:
include:
- name: macOS aarch64
target: aarch64-apple-darwin
- name: macOS x86_64
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
with:
cache-key: notarize
- name: Build release tool
run: cargo build --locked --package xtask
- name: Download submitted disk image and notarization submission ID
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: notarize-${{ matrix.target }}
path: notarize
- name: Wait for notarization, staple and upload the disk image
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_ID: ${{ needs.create-release.outputs.release_id }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_NOTARY_API_ISSUER_ID: ${{ secrets.APPLE_NOTARY_API_ISSUER_ID }}
APPLE_NOTARY_API_KEY: ${{ secrets.APPLE_NOTARY_API_KEY }}
APPLE_NOTARY_API_KEY_ID: ${{ secrets.APPLE_NOTARY_API_KEY_ID }}
run: >-
./target/debug/xtask release-notarize
--repository "$GITHUB_REPOSITORY"
--release-id "$RELEASE_ID"
--target ${{ matrix.target }}
--notarize-dir notarize
generate-latest-json:
name: Generate updater metadata
needs:
- create-release
- build
- notarize
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
- name: Generate and upload latest.json
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_ID: ${{ needs.create-release.outputs.release_id }}
run: >-
cargo x latest-json --dev
--repository "$GITHUB_REPOSITORY"
--release-id "$RELEASE_ID"
publish-release:
name: Publish
needs:
- create-release
- generate-latest-json
runs-on: ubuntu-latest
steps:
- name: Publish prerelease
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_ID: ${{ needs.create-release.outputs.release_id }}
run: |
gh api --method PATCH \
"repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" \
-F draft=false \
-F prerelease=true
publish-update-channel:
name: Publish dev updater channel
needs:
- create-release
- publish-release
runs-on: ubuntu-latest
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Download updater metadata
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ needs.create-release.outputs.tag }}
run: |
mkdir site
gh release download "$RELEASE_TAG" \
--repo "$GITHUB_REPOSITORY" \
--pattern latest.json \
--dir site
mv site/latest.json site/latest-dev.json
jq --exit-status '.version and (.platforms | length > 0)' site/latest-dev.json >/dev/null
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: site
- name: Deploy GitHub Pages
id: deployment
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1