-
Notifications
You must be signed in to change notification settings - Fork 3
528 lines (446 loc) · 17.4 KB
/
Copy pathrelease-artifacts.yml
File metadata and controls
528 lines (446 loc) · 17.4 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
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
name: Release Artifacts
on:
workflow_dispatch:
inputs:
windows_signed:
description: Build signed Windows portable package through the release-signing environment
required: false
default: false
type: boolean
macos_signed:
description: Build signed and notarized macOS app packages through the release-signing environment
required: false
default: false
type: boolean
macos_x64:
description: Also build the Intel x64 macOS app package
required: false
default: false
type: boolean
publish_itch:
description: Publish signed desktop artifacts and the HTML5 build to itch.io
required: false
default: false
type: boolean
push:
tags:
- "v*.*.*"
permissions:
contents: read
env:
TELEMETRY_PROVIDER: ${{ vars.TELEMETRY_PROVIDER }}
TELEMETRY_POSTHOG_PROJECT_KEY: ${{ secrets.TELEMETRY_POSTHOG_PROJECT_KEY }}
TELEMETRY_POSTHOG_HOST: ${{ vars.TELEMETRY_POSTHOG_HOST }}
TELEMETRY_ENABLED: ${{ vars.TELEMETRY_ENABLED }}
TELEMETRY_BUILD_CHANNEL: ${{ vars.TELEMETRY_BUILD_CHANNEL }}
jobs:
checks:
name: Release gates
runs-on: ubuntu-24.04
timeout-minutes: 45
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Validate release tag
if: ${{ github.ref_type == 'tag' }}
run: |
node -e 'const pkg = require("./package.json"); const tag = process.env.GITHUB_REF_NAME; const expected = "v" + pkg.version; if (tag !== expected) { console.error(`Release tag ${tag} does not match package version ${pkg.version}. Expected ${expected}.`); process.exit(1); }'
- name: Install dependencies
run: npm ci
- name: Check licenses
run: npm run license:check
- name: Typecheck
run: npm run typecheck
- name: Test
run: npm test
- name: Lint
run: npm run lint
web:
name: itch.io web release package
runs-on: ubuntu-24.04
timeout-minutes: 30
needs: checks
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Install dependencies
run: npm ci
- name: Build itch.io web package
run: npm run web:package:itch
env:
TELEMETRY_DISTRIBUTION: web_itch
- name: Upload itch.io web package
uses: actions/upload-artifact@v7
with:
name: pixelaid-web-itch
path: artifacts/web/*web-itch.zip
archive: false
if-no-files-found: error
retention-days: 30
windows:
name: Windows portable release package
runs-on: windows-2022
timeout-minutes: 60
needs: checks
if: ${{ github.ref_type != 'tag' && github.event.inputs.windows_signed != 'true' }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Setup Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
- name: Show tool versions
run: |
node --version
npm --version
rustc --version
cargo --version
- name: Install dependencies
run: npm ci
- name: Build unsigned Windows portable package
run: npm run desktop:package:windows
env:
TELEMETRY_DISTRIBUTION: desktop_windows_portable
- name: Verify Windows package
run: |
$zip = Get-ChildItem artifacts/desktop/*windows*-portable.zip | Select-Object -First 1
if (-not $zip) {
throw "No Windows portable zip found."
}
tar -tf $zip.FullName
$extractDir = Join-Path $env:RUNNER_TEMP "pixelaid-windows"
if (Test-Path $extractDir) {
Remove-Item -Recurse -Force $extractDir
}
New-Item -ItemType Directory -Path $extractDir | Out-Null
tar -xf $zip.FullName -C $extractDir
node apps/desktop/scripts/verify-desktop-package.mjs windows $extractDir
- name: Upload Windows portable package
uses: actions/upload-artifact@v7
with:
name: pixelaid-windows-portable
path: artifacts/desktop/*windows*-portable.zip
archive: false
if-no-files-found: error
retention-days: 30
windows-signed:
name: Windows signed portable release package
runs-on: windows-2022
timeout-minutes: 75
needs: checks
if: ${{ github.ref_type == 'tag' || github.event.inputs.windows_signed == 'true' }}
environment: release-signing
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x
- name: Setup Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
- name: Azure login
uses: azure/login@v3
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Restore Microsoft Artifact Signing client
shell: pwsh
run: |
$projectDir = Join-Path $env:RUNNER_TEMP "artifact-signing-client"
New-Item -ItemType Directory -Path $projectDir -Force | Out-Null
dotnet new classlib --framework net8.0 --output $projectDir
$project = Join-Path $projectDir "artifact-signing-client.csproj"
dotnet add $project package Microsoft.ArtifactSigning.Client
- name: Show tool versions
run: |
node --version
npm --version
dotnet --version
rustc --version
cargo --version
- name: Install dependencies
run: npm ci
- name: Build signed Windows portable package
run: npm run desktop:package:windows:signed
env:
TELEMETRY_DISTRIBUTION: desktop_windows_portable
WINDOWS_SIGNING_ENDPOINT: ${{ secrets.WINDOWS_SIGNING_ENDPOINT }}
WINDOWS_SIGNING_ACCOUNT_NAME: ${{ secrets.WINDOWS_SIGNING_ACCOUNT_NAME }}
WINDOWS_SIGNING_CERTIFICATE_PROFILE_NAME: ${{ secrets.WINDOWS_SIGNING_CERTIFICATE_PROFILE_NAME }}
- name: Verify signed Windows package
run: |
$zip = Get-ChildItem artifacts/desktop/*windows*-signed-portable.zip | Select-Object -First 1
if (-not $zip) {
throw "No signed Windows portable zip found."
}
tar -tf $zip.FullName
$extractDir = Join-Path $env:RUNNER_TEMP "pixelaid-windows-signed"
if (Test-Path $extractDir) {
Remove-Item -Recurse -Force $extractDir
}
New-Item -ItemType Directory -Path $extractDir | Out-Null
tar -xf $zip.FullName -C $extractDir
node apps/desktop/scripts/verify-desktop-package.mjs windows $extractDir --signed
- name: Upload signed Windows portable package
uses: actions/upload-artifact@v7
with:
name: pixelaid-windows-signed-portable
path: artifacts/desktop/*windows*-signed-portable.zip
archive: false
if-no-files-found: error
retention-days: 30
macos:
name: macOS app release package (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 60
needs: checks
if: ${{ github.ref_type != 'tag' && github.event.inputs.macos_signed != 'true' }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON((github.ref_type == 'tag' || github.event.inputs.macos_x64 == 'true') && '[{"runner":"macos-15","arch":"arm64"},{"runner":"macos-15-intel","arch":"x64"}]' || '[{"runner":"macos-15","arch":"arm64"}]') }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Setup Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
- name: Show tool versions
run: |
node --version
npm --version
rustc --version
cargo --version
uname -m
- name: Install dependencies
run: npm ci
- name: Build unsigned macOS app package
run: npm run desktop:package:macos -- --arch ${{ matrix.arch }}
env:
TELEMETRY_DISTRIBUTION: desktop_macos_app
- name: Verify macOS package
run: |
zip="$(find artifacts/desktop -name '*macos*-${{ matrix.arch }}-app.zip' -print -quit)"
if [ -z "$zip" ]; then
echo "No macOS ${{ matrix.arch }} app zip found." >&2
exit 1
fi
unzip -l "$zip"
extract_dir="$RUNNER_TEMP/pixelaid-macos-${{ matrix.arch }}"
rm -rf "$extract_dir"
mkdir -p "$extract_dir"
ditto -x -k "$zip" "$extract_dir"
node apps/desktop/scripts/verify-desktop-package.mjs macos "$extract_dir" "${{ matrix.arch }}"
- name: Upload macOS app package
uses: actions/upload-artifact@v7
with:
name: pixelaid-macos-${{ matrix.arch }}-app
path: artifacts/desktop/*macos*-${{ matrix.arch }}-app.zip
archive: false
if-no-files-found: error
retention-days: 30
macos-signed:
name: macOS signed app release package (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
timeout-minutes: 90
needs: checks
if: ${{ github.ref_type == 'tag' || github.event.inputs.macos_signed == 'true' }}
environment: release-signing
permissions:
contents: read
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON((github.ref_type == 'tag' || github.event.inputs.macos_x64 == 'true') && '[{"runner":"macos-15","arch":"arm64"},{"runner":"macos-15-intel","arch":"x64"}]' || '[{"runner":"macos-15","arch":"arm64"}]') }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- name: Setup Rust
run: |
rustup toolchain install stable --profile minimal
rustup default stable
- name: Show tool versions
run: |
node --version
npm --version
rustc --version
cargo --version
uname -m
- name: Install dependencies
run: npm ci
- name: Import Apple signing assets
shell: bash
env:
MACOS_CERTIFICATE_P12_BASE64: ${{ secrets.MACOS_CERTIFICATE_P12_BASE64 }}
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
MACOS_KEYCHAIN_PASSWORD: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_P8_BASE64: ${{ secrets.APPLE_API_KEY_P8_BASE64 }}
run: |
for required in MACOS_CERTIFICATE_P12_BASE64 MACOS_CERTIFICATE_PASSWORD MACOS_KEYCHAIN_PASSWORD APPLE_API_KEY APPLE_API_KEY_P8_BASE64; do
if [ -z "${!required}" ]; then
echo "$required is required for signed macOS release artifacts." >&2
exit 1
fi
done
certificate_path="$RUNNER_TEMP/pixelaid-certificate.p12"
api_key_dir="$RUNNER_TEMP/appstoreconnect/private_keys"
api_key_path="$api_key_dir/AuthKey_${APPLE_API_KEY}.p8"
keychain_path="$RUNNER_TEMP/pixelaid-signing.keychain-db"
mkdir -p "$api_key_dir"
printf '%s' "$MACOS_CERTIFICATE_P12_BASE64" | base64 -D > "$certificate_path"
printf '%s' "$APPLE_API_KEY_P8_BASE64" | base64 -D > "$api_key_path"
security create-keychain -p "$MACOS_KEYCHAIN_PASSWORD" "$keychain_path"
security set-keychain-settings -lut 21600 "$keychain_path"
security unlock-keychain -p "$MACOS_KEYCHAIN_PASSWORD" "$keychain_path"
security import "$certificate_path" -P "$MACOS_CERTIFICATE_PASSWORD" -A -t cert -f pkcs12 -k "$keychain_path"
security list-keychains -d user -s "$keychain_path" $(security list-keychains -d user | sed 's/"//g')
security default-keychain -s "$keychain_path"
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_KEYCHAIN_PASSWORD" "$keychain_path"
echo "APPLE_API_KEY_PATH=$api_key_path" >> "$GITHUB_ENV"
echo "MACOS_SIGNING_KEYCHAIN=$keychain_path" >> "$GITHUB_ENV"
- name: Build signed macOS app package
run: npm run desktop:package:macos:signed -- --arch ${{ matrix.arch }}
env:
TELEMETRY_DISTRIBUTION: desktop_macos_app
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
- name: Verify signed macOS package
run: |
zip="$(find artifacts/desktop -name '*macos*-${{ matrix.arch }}-signed-app.zip' -print -quit)"
if [ -z "$zip" ]; then
echo "No signed macOS ${{ matrix.arch }} app zip found." >&2
exit 1
fi
unzip -l "$zip"
extract_dir="$RUNNER_TEMP/pixelaid-macos-${{ matrix.arch }}-signed"
rm -rf "$extract_dir"
mkdir -p "$extract_dir"
ditto -x -k "$zip" "$extract_dir"
node apps/desktop/scripts/verify-desktop-package.mjs macos "$extract_dir" "${{ matrix.arch }}" --signed
- name: Upload signed macOS app package
uses: actions/upload-artifact@v7
with:
name: pixelaid-macos-${{ matrix.arch }}-signed-app
path: artifacts/desktop/*macos*-${{ matrix.arch }}-signed-app.zip
archive: false
if-no-files-found: error
retention-days: 30
- name: Cleanup Apple signing assets
if: ${{ always() }}
run: |
keychain_path="${MACOS_SIGNING_KEYCHAIN:-$RUNNER_TEMP/pixelaid-signing.keychain-db}"
if [ -f "$keychain_path" ]; then
security delete-keychain "$keychain_path" || true
fi
rm -f "$RUNNER_TEMP/pixelaid-certificate.p12"
rm -rf "$RUNNER_TEMP/appstoreconnect"
publish-itch:
name: Publish itch.io channels
runs-on: ubuntu-24.04
timeout-minutes: 45
needs:
- web
- windows
- windows-signed
- macos
- macos-signed
if: ${{ always() && (github.ref_type == 'tag' || github.event.inputs.publish_itch == 'true') }}
environment: release-publishing
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Validate publish inputs
env:
NEEDS_JSON: ${{ toJSON(needs) }}
RELEASE_TAG: ${{ github.ref_type == 'tag' }}
WINDOWS_SIGNED: ${{ github.event.inputs.windows_signed }}
MACOS_SIGNED: ${{ github.event.inputs.macos_signed }}
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
ITCH_TARGET: ${{ vars.ITCH_TARGET }}
run: |
if [ "$RELEASE_TAG" != "true" ] && { [ "$WINDOWS_SIGNED" != "true" ] || [ "$MACOS_SIGNED" != "true" ]; }; then
echo "Itch publishing requires windows_signed and macos_signed." >&2
exit 1
fi
if [ -z "$BUTLER_API_KEY" ]; then
echo "BUTLER_API_KEY is required for itch.io publishing." >&2
exit 1
fi
if [ -z "$ITCH_TARGET" ]; then
echo "ITCH_TARGET is required for itch.io publishing." >&2
exit 1
fi
node <<'NODE'
const needs = JSON.parse(process.env.NEEDS_JSON);
const required = {
web: "itch.io web package",
"windows-signed": "signed Windows package",
"macos-signed": "signed macOS package",
};
const failed = Object.entries(required)
.filter(([id]) => needs[id]?.result !== "success")
.map(([id, label]) => `${label}: ${needs[id]?.result ?? "missing"}`);
if (failed.length > 0) {
console.error(`Cannot publish itch.io artifacts because required jobs did not succeed: ${failed.join(", ")}`);
process.exit(1);
}
NODE
- name: Download release artifacts
uses: actions/download-artifact@v8
with:
path: release-artifacts
skip-decompress: true
- name: Install butler
run: |
curl -L -o "$RUNNER_TEMP/butler.zip" https://broth.itch.zone/butler/linux-amd64/LATEST/archive/default
unzip -q "$RUNNER_TEMP/butler.zip" -d "$RUNNER_TEMP/butler"
chmod +x "$RUNNER_TEMP/butler/butler"
echo "$RUNNER_TEMP/butler" >> "$GITHUB_PATH"
"$RUNNER_TEMP/butler/butler" version
- name: Publish itch.io channels
env:
BUTLER_API_KEY: ${{ secrets.BUTLER_API_KEY }}
ITCH_TARGET: ${{ vars.ITCH_TARGET }}
PUBLISH_MACOS_X64: ${{ github.ref_type == 'tag' || github.event.inputs.macos_x64 == 'true' }}
run: bash scripts/publish-itch-artifacts.sh