Repository navigation
477 lines (422 loc) · 16.3 KB
/
Copy pathrelease.yml
File metadata and controls
477 lines (422 loc) · 16.3 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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
env:
CARGO_TERM_COLOR: always
jobs:
version:
name: Resolve version
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
version: ${{ steps.resolve.outputs.version }}
tag: ${{ steps.resolve.outputs.tag }}
published: ${{ steps.published.outputs.published }}
steps:
- uses: actions/checkout@v6
- name: Resolve version from Cargo.toml
id: resolve
run: |
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)
if [ -z "$version" ]; then
echo "::error::No version found in Cargo.toml"
exit 1
fi
# Cargo.toml is the source of truth. A tag push must agree with it;
# a manual run has no tag and simply releases what Cargo.toml says.
if [ "$GITHUB_EVENT_NAME" = push ]; then
tag="${GITHUB_REF_NAME#v}"
if [ "$tag" != "$version" ]; then
echo "::error::Tag ${GITHUB_REF_NAME} does not match Cargo.toml version ${version}"
exit 1
fi
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=v$version" >> "$GITHUB_OUTPUT"
echo "Releasing $version as v$version"
# A published release for this version is already the finished product,
# so rebuilding it would burn 90 minutes and could replace artifacts
# people have downloaded. A leftover draft is this workflow's own
# output, so it does not count and gets overwritten as before.
- name: Look for an existing published release
id: published
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ steps.resolve.outputs.tag }}
run: |
draft=$(gh release view "$TAG" --repo "$GITHUB_REPOSITORY" \
--json isDraft --jq .isDraft 2>/dev/null) || draft=missing
if [ "$draft" = false ]; then
echo "published=true" >> "$GITHUB_OUTPUT"
echo "::notice::$TAG is already published; skipping this run"
else
echo "published=false" >> "$GITHUB_OUTPUT"
fi
linux-x86_64:
name: Linux x86_64
needs: version
if: needs.version.outputs.published != 'true'
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- name: Install Rust
run: |
rustup toolchain install 1.96.0 --profile minimal
rustup default 1.96.0
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install --yes \
clang \
cmake \
libfontconfig-dev \
libvulkan1 \
libwayland-dev \
libx11-xcb-dev \
libxi-dev \
libxtst-dev \
libxkbcommon-x11-dev \
pkg-config \
xdg-desktop-portal
- uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ubuntu-22.04-rust-1.96.0-release-${{ hashFiles('Cargo.lock') }}
restore-keys: |
ubuntu-22.04-rust-1.96.0-release-
# `target/` is restored from the release cache, so the previous
# release's bundles are still sitting in `target/release` when this one
# starts. Cargo does not own them, so nothing else clears them.
- name: Clear stale bundles
run: rm -f target/release/waku-*.tar.gz
- name: Bundle
env:
WAKU_ANALYTICS_ENDPOINT: ${{ secrets.WAKU_ANALYTICS_ENDPOINT }}
WAKU_ANALYTICS_WEBSITE_ID: ${{ secrets.WAKU_ANALYTICS_WEBSITE_ID }}
run: ./scripts/bundle-linux.sh
- uses: actions/upload-artifact@v7
with:
name: linux-x86_64
# Named exactly, not globbed: `if-no-files-found: error` is then a
# real check that this version built, rather than something an older
# bundle can satisfy.
path: target/release/waku-${{ needs.version.outputs.version }}-x86_64-unknown-linux-gnu.tar.gz
if-no-files-found: error
linux-arm64:
name: Linux arm64
needs: version
if: needs.version.outputs.published != 'true'
runs-on: ubuntu-22.04-arm
timeout-minutes: 90
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- name: Install Rust
run: |
rustup toolchain install 1.96.0 --profile minimal
rustup default 1.96.0
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install --yes \
clang \
cmake \
libfontconfig-dev \
libvulkan1 \
libwayland-dev \
libx11-xcb-dev \
libxi-dev \
libxtst-dev \
libxkbcommon-x11-dev \
pkg-config \
xdg-desktop-portal
- uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ubuntu-22.04-arm-rust-1.96.0-release-${{ hashFiles('Cargo.lock') }}
restore-keys: |
ubuntu-22.04-arm-rust-1.96.0-release-
# `target/` is restored from the release cache, so the previous
# release's bundles are still sitting in `target/release` when this one
# starts. Cargo does not own them, so nothing else clears them.
- name: Clear stale bundles
run: rm -f target/release/waku-*.tar.gz
- name: Bundle
env:
WAKU_ANALYTICS_ENDPOINT: ${{ secrets.WAKU_ANALYTICS_ENDPOINT }}
WAKU_ANALYTICS_WEBSITE_ID: ${{ secrets.WAKU_ANALYTICS_WEBSITE_ID }}
run: ./scripts/bundle-linux.sh
- uses: actions/upload-artifact@v7
with:
name: linux-arm64
path: target/release/waku-${{ needs.version.outputs.version }}-aarch64-unknown-linux-gnu.tar.gz
if-no-files-found: error
windows-x86_64:
name: Windows x86_64
needs: version
if: needs.version.outputs.published != 'true'
runs-on: windows-latest
timeout-minutes: 90
steps:
- uses: actions/checkout@v6
- name: Install Rust
run: |
rustup toolchain install 1.96.0 --profile minimal
rustup default 1.96.0
rustup target add x86_64-pc-windows-msvc
- uses: oven-sh/setup-bun@v2
- name: Install Inno Setup
run: choco install innosetup --yes --no-progress
- uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: windows-latest-rust-1.96.0-release-${{ hashFiles('Cargo.lock') }}
restore-keys: |
windows-latest-rust-1.96.0-release-
# `target/` is restored from the release cache, so the previous
# release's bundles are still sitting in `target/release` when this one
# starts. Cargo does not own them, so nothing else clears them.
- name: Clear stale bundles
run: Remove-Item -Force -ErrorAction SilentlyContinue target/release/waku-*.zip, target/release/Dinosaur-*-Setup.exe
- name: Bundle
env:
WAKU_ANALYTICS_ENDPOINT: ${{ secrets.WAKU_ANALYTICS_ENDPOINT }}
WAKU_ANALYTICS_WEBSITE_ID: ${{ secrets.WAKU_ANALYTICS_WEBSITE_ID }}
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
run: bun scripts/bundle-windows.ts
- uses: actions/upload-artifact@v7
with:
name: windows-x86_64
path: |
target/release/waku-${{ needs.version.outputs.version }}-x86_64-pc-windows-msvc.zip
target/release/Dinosaur-${{ needs.version.outputs.version }}-x86_64-Setup.exe
if-no-files-found: error
windows-arm64:
name: Windows arm64
needs: version
if: needs.version.outputs.published != 'true'
runs-on: windows-11-arm
timeout-minutes: 90
steps:
- uses: actions/checkout@v6
- name: Install Rust
run: |
rustup toolchain install 1.96.0 --profile minimal
rustup default 1.96.0
rustup target add aarch64-pc-windows-msvc
- uses: oven-sh/setup-bun@v2
- name: Install Inno Setup
run: choco install innosetup --yes --no-progress
- uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: windows-11-arm-rust-1.96.0-release-${{ hashFiles('Cargo.lock') }}
restore-keys: |
windows-11-arm-rust-1.96.0-release-
# `target/` is restored from the release cache, so the previous
# release's bundles are still sitting in `target/release` when this one
# starts. Cargo does not own them, so nothing else clears them.
- name: Clear stale bundles
run: Remove-Item -Force -ErrorAction SilentlyContinue target/release/waku-*.zip, target/release/Dinosaur-*-Setup.exe
- name: Bundle
env:
WAKU_ANALYTICS_ENDPOINT: ${{ secrets.WAKU_ANALYTICS_ENDPOINT }}
WAKU_ANALYTICS_WEBSITE_ID: ${{ secrets.WAKU_ANALYTICS_WEBSITE_ID }}
WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }}
WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
run: bun scripts/bundle-windows.ts
- uses: actions/upload-artifact@v7
with:
name: windows-arm64
path: |
target/release/waku-${{ needs.version.outputs.version }}-aarch64-pc-windows-msvc.zip
target/release/Dinosaur-${{ needs.version.outputs.version }}-aarch64-Setup.exe
if-no-files-found: error
macos:
name: macOS
needs: version
if: needs.version.outputs.published != 'true'
runs-on: macos-latest
timeout-minutes: 90
env:
# Without a Developer ID certificate the job still ships a macOS build:
# ad-hoc signed and unnotarized, so Gatekeeper needs a manual override
# on first launch. Sparkle updates stay verified by the EdDSA key.
DEVELOPER_ID_SIGNING: ${{ secrets.APPLE_CERTIFICATE != '' }}
steps:
- uses: actions/checkout@v6
- name: Install Rust
run: |
rustup toolchain install 1.96.0 --profile minimal
rustup default 1.96.0
- uses: oven-sh/setup-bun@v2
- name: Install create-dmg
run: brew install create-dmg
- uses: actions/cache@v6
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: macos-latest-rust-1.96.0-release-${{ hashFiles('Cargo.lock') }}
restore-keys: |
macos-latest-rust-1.96.0-release-
- name: Import Apple Developer Certificate
if: env.DEVELOPER_ID_SIGNING == 'true'
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
run: |
KEYCHAIN_PASSWORD=$(openssl rand -base64 24)
echo $APPLE_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
security set-keychain-settings -t 3600 -u build.keychain
security import certificate.p12 -k build.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain
security find-identity -v -p codesigning build.keychain
rm certificate.p12
- name: Store notary credentials
if: env.DEVELOPER_ID_SIGNING == 'true'
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
xcrun notarytool store-credentials NOTARY \
--apple-id "$APPLE_ID" \
--password "$APPLE_APP_SPECIFIC_PASSWORD" \
--team-id "$APPLE_TEAM_ID"
- name: Release
env:
WAKU_SIGNING_IDENTITY: ${{ secrets.WAKU_SIGNING_IDENTITY }}
WAKU_ANALYTICS_ENDPOINT: ${{ secrets.WAKU_ANALYTICS_ENDPOINT }}
WAKU_ANALYTICS_WEBSITE_ID: ${{ secrets.WAKU_ANALYTICS_WEBSITE_ID }}
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
run: |
if [ "$DEVELOPER_ID_SIGNING" = true ]; then
bun run release
else
echo "::warning::No APPLE_CERTIFICATE secret; building an ad-hoc signed, unnotarized macOS release"
bun run release --adhoc
fi
- uses: actions/upload-artifact@v7
with:
name: macos
path: |
dist/Dinosaur-${{ needs.version.outputs.version }}.dmg
dist/Dinosaur-${{ needs.version.outputs.version }}.md
dist/Dinosaur-${{ needs.version.outputs.version }}.zip
dist/appcast.xml
if-no-files-found: error
draft-release:
name: Draft GitHub release
needs:
[
version,
linux-x86_64,
linux-arm64,
windows-x86_64,
windows-arm64,
macos,
]
if: needs.version.outputs.published != 'true'
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- uses: oven-sh/setup-bun@v2
- uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
- name: Write the version pointers
env:
VERSION: ${{ needs.version.outputs.version }}
run: |
# What `install.sh` and the website's Windows download resolve
# "latest" to. In-app updates read the appcasts instead.
echo "$VERSION" > artifacts/latest-linux.txt
echo "$VERSION" > artifacts/latest-windows.txt
# Signed here rather than on platform runners: this is the only job that
# holds every native artifact, and the signing key stays in one place.
- name: Sign the Linux and Windows update feeds
env:
VERSION: ${{ needs.version.outputs.version }}
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
run: |
# Merge into the live feeds (the latest published release's copies)
# so earlier releases keep their entries; a first run simply starts
# from nothing.
for platform in linux windows; do
for arch in x86_64 aarch64; do
curl -fsSL --max-time 30 \
"https://github.com/$GITHUB_REPOSITORY/releases/latest/download/appcast-$platform-$arch.xml" \
-o "artifacts/appcast-$platform-$arch.xml" || true
done
done
bun scripts/appcast-linux.ts artifacts "$VERSION"
bun scripts/appcast-windows.ts artifacts "$VERSION"
- name: Write release notes
env:
VERSION: ${{ needs.version.outputs.version }}
run: |
bun -e '
import { extractReleaseNotes } from "./scripts/changelog.ts";
const version = process.env.VERSION;
const file = Bun.file("CHANGELOG.md");
const notes = (await file.exists())
? extractReleaseNotes(await file.text(), version)
: null;
await Bun.write(
"release-notes.md",
`${notes ?? "See CHANGELOG.md for details."}\n`,
);
'
- uses: softprops/action-gh-release@v3
with:
draft: true
# A manual run has no tag yet; publishing the draft creates this one
# at the commit that was built.
tag_name: ${{ needs.version.outputs.tag }}
target_commitish: ${{ github.sha }}
name: ${{ needs.version.outputs.tag }}
body_path: release-notes.md
fail_on_unmatched_files: true
files: |
artifacts/*.tar.gz
artifacts/*.dmg
artifacts/*.md
artifacts/*.zip
artifacts/*.exe
artifacts/appcast.xml
artifacts/appcast-linux-*.xml
artifacts/appcast-windows-*.xml
artifacts/latest-linux.txt
artifacts/latest-windows.txt