Repository navigation
2070 lines (1945 loc) · 107 KB
/
Copy pathrelease.yml
File metadata and controls
2070 lines (1945 loc) · 107 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
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Varve release pipeline.
#
# Replaces publish.yml, which could never reach its `release` job: that job
# declared `needs: [bundle, aur-validate]`, and `aur-validate` chowns `dist/aur`
# — a directory that does not exist and is gitignored. See
# docs/release/release-readiness-audit.md RB-2.
#
# Design rules this workflow enforces:
# - A tag never releases anything by itself. It builds a DRAFT; a human
# publishes.
# - The tag and the application version must agree before anything is built.
# - Signing credentials are validated in `signing-preflight` BEFORE any
# platform build starts. When signing is required, missing credentials fail
# there; permitted unsigned builds retain truthful labels.
# - An artifact is never labelled signed unless the post-build cryptographic
# verification report (verify-windows-signature.ps1 /
# verify-macos-signature.sh) confirms it on the actual bytes.
# - `verify` is the fail-closed trust gate: it merges the per-platform
# reports into the release manifest, enforces the channel policy, and only
# THEN generates the final checksums and attests the final bytes.
# - Every artifact is renamed to one predictable scheme, hashed, and verified
# against the bytes that will actually be uploaded.
#
# Third-party actions are pinned to full commit SHAs (enforced by
# scripts/pin-github-actions.mjs). To update one, run `just pin-actions-fix`.
name: Release
on:
push:
tags:
# Stable and prerelease tags both match; the channel is derived from the
# tag shape in the `preflight` job rather than from a separate trigger, so
# a prerelease can never overwrite a stable release by accident.
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+-*'
workflow_dispatch:
inputs:
tag:
description: 'Existing tag to build (e.g. v0.1.0)'
required: true
platforms:
description: 'Which platforms to build'
required: true
# A manually dispatched release must be complete by default. Linux-only
# rehearsals remain available as an explicit opt-in.
default: 'all'
type: choice
options: [linux, linux-windows, all]
publish:
description: 'Explicitly publish the existing draft for this tag (never auto-runs)'
required: false
default: 'no'
type: choice
# Quote these values: YAML 1.1 treats bare `no`/`yes` as booleans,
# which makes GitHub reject the documented `publish=yes` dispatch.
options: ['no', 'yes']
build_run_id:
description: 'Successful master recovery build run that produced this draft (required for recovery publication)'
required: false
default: ''
type: string
reuse_run_id:
description: 'Completed master Release run whose successful platform artifacts should be retained'
required: false
default: ''
type: string
reuse_targets:
description: 'Explicit comma-separated successful platform targets to retain from reuse_run_id'
required: false
default: ''
type: string
# Installer-size gate override. The gate compares the NSIS installer
# against scripts/release/installer-size-baseline.json and blocks
# unexplained growth (warn 1.2x / block 1.35x of expected). Provide a
# reason here ONLY for intentional growth (e.g. bundling a new model or
# changing the WebView2 install mode); update the baseline in the same
# commit that ships the change. Tag-triggered releases default to no
# override, so growth has to be accepted deliberately per release.
size_gate_override:
description: 'Reason to accept an installer size above the hard threshold (leave empty to enforce)'
required: false
default: ''
type: string
concurrency:
# Never cancel a release build in flight — a half-uploaded draft is worse than
# a slow one.
group: release-${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
cancel-in-progress: false
permissions:
contents: read
actions: read
checks: read
env:
PNPM_VERSION: '11.9.0'
NODE_VERSION: '26.10.0'
jobs:
# ── 1. Preflight: refuse to build the wrong thing ───────────────────────────
preflight:
name: Preflight
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
version: ${{ steps.resolve.outputs.version }}
tag: ${{ steps.resolve.outputs.tag }}
prerelease: ${{ steps.resolve.outputs.prerelease }}
channel: ${{ steps.resolve.outputs.channel }}
build_windows: ${{ steps.resolve.outputs.build_windows }}
build_macos: ${{ steps.resolve.outputs.build_macos }}
tag_sha: ${{ steps.certification.outputs.tag_sha }}
policy_hash: ${{ steps.certification.outputs.policy_hash }}
reuse_run_id: ${{ steps.reuse.outputs.reuse_run_id }}
reuse_targets: ${{ steps.reuse.outputs.reuse_targets }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ inputs.tag || github.ref }}
# Keep ancestry for provenance, fetch only tagged release metadata.
fetch-depth: 0
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/scripts/
/package.json
/apps/desktop/package.json
/apps/desktop/src-tauri/tauri.conf.json
/Cargo.toml
/apps/desktop/src-tauri/Cargo.toml
/README.md
/CHANGELOG.md
/apps/desktop/src-tauri/linux/dev.varve.desktop.metainfo.xml
/packaging/aur/varve-desktop-bin/PKGBUILD
/packaging/aur/varve-desktop-bin/.SRCINFO
- name: Materialize tagged policy inputs
run: |
set -euo pipefail
node --input-type=module -e 'import { POLICY_FILES } from "./scripts/quality/validation-policy.mjs"; process.stdout.write(POLICY_FILES.map(path => `/${path}`).join("\n") + "\n");' \
| git sparse-checkout add --stdin
- name: Resolve tag, version and channel
id: resolve
env:
RELEASE_TAG_INPUT: ${{ inputs.tag || github.ref_name }}
RELEASE_PLATFORMS_INPUT: ${{ inputs.platforms || 'all' }}
run: |
set -euo pipefail
TAG="$RELEASE_TAG_INPUT"
if [[ ! "${TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$ ]]; then
echo "::error::Release tag '${TAG}' is not a valid vMAJOR.MINOR.PATCH tag."
exit 1
fi
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
# Anything with a hyphen after the patch number is a prerelease
# (v0.1.0-alpha.1). Stable tags are bare (v0.1.0).
if [[ "${TAG}" == *-* ]]; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
echo "channel=${TAG#*-}" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
echo "channel=stable" >> "$GITHUB_OUTPUT"
fi
VERSION="$(node scripts/release/version.mjs get)"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
PLATFORMS="$RELEASE_PLATFORMS_INPUT"
BUILD_WINDOWS=true
BUILD_MACOS=true
if [[ "${PLATFORMS}" == "linux" ]]; then
BUILD_WINDOWS=false
BUILD_MACOS=false
elif [[ "${PLATFORMS}" == "linux-windows" ]]; then
BUILD_MACOS=false
fi
echo "build_windows=${BUILD_WINDOWS}" >> "$GITHUB_OUTPUT"
echo "build_macos=${BUILD_MACOS}" >> "$GITHUB_OUTPUT"
- name: Verify tag matches application version
# The whole point of the gate: a v0.1.0 tag must not produce installers
# that identify themselves as 0.0.0 (audit RB-3).
env:
RELEASE_TAG: ${{ steps.resolve.outputs.tag }}
run: node scripts/release/version.mjs verify "$RELEASE_TAG"
- name: Verify tag points at an approved source commit
# A version-looking tag is not sufficient to ship code. The tagged
# commit must be reachable from the protected default branch; a
# workflow_dispatch input can name any existing tag, and without this
# gate it could release a commit that was never part of the default
# branch history. Fail closed.
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch || 'master' }}
RELEASE_TAG: ${{ steps.resolve.outputs.tag }}
run: |
set -euo pipefail
TAG_COMMIT="$(git rev-parse "${RELEASE_TAG}^{commit}")"
BASE_COMMIT="$(git rev-parse "origin/${DEFAULT_BRANCH}^{commit}")"
if ! git merge-base --is-ancestor "${TAG_COMMIT}" "${BASE_COMMIT}"; then
echo "::error::Tag ${RELEASE_TAG} points at commit ${TAG_COMMIT}, which is not reachable"
echo "from the default branch (${DEFAULT_BRANCH} at ${BASE_COMMIT})."
echo "Release tags must point at a commit in the protected default branch history."
exit 1
fi
echo "Tag ${RELEASE_TAG} (${TAG_COMMIT}) is reachable from ${DEFAULT_BRANCH} — provenance OK."
- name: Verify changelog has an entry for this version
# Uses the same extractor that generates the notes, so the gate cannot
# pass on something the generator would choke on. A plain grep matched
# the commented-out `## [0.1.0]` template at the bottom of the file and
# would have shipped bare "### Added" headings — and a stray "-->" — as
# the public release notes.
env:
RELEASE_VERSION: ${{ steps.resolve.outputs.version }}
run: |
if [[ ! -f CHANGELOG.md ]]; then
echo "::error::CHANGELOG.md is missing. Release notes are generated from it."
exit 1
fi
if ! node scripts/release/release-notes.mjs --check "$RELEASE_VERSION"; then
echo "::error::CHANGELOG.md has no usable '## [${RELEASE_VERSION}]' section."
echo "Add one before tagging — release notes are generated from the changelog,"
echo "not from commit messages."
exit 1
fi
# Recovery tooling belongs to this immutable workflow revision. Product
# bytes and the certification policy below still come from the tag.
# This lets a manual master dispatch repair orchestration without moving
# an already-created release tag or using its broken verifier again.
- name: Check out workflow certification tooling
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.workflow_sha }}
path: release-tooling
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/scripts/release/certification.mjs
/scripts/release/verify-certification.mjs
/scripts/release/select-run-artifacts.mjs
/scripts/release/resume.mjs
/scripts/quality/validation-policy.mjs
# This is intentionally before pnpm/Rust setup and before any platform
# build. A tag is not a release candidate: the exact tag commit must have
# both required remote certifications and the matching policy hash.
- name: Verify exact-SHA integration and release-candidate certification
id: certification
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
RELEASE_TAG: ${{ steps.resolve.outputs.tag }}
run: |
set -euo pipefail
TAG_SHA="$(git rev-parse "${RELEASE_TAG}^{commit}")"
POLICY_HASH="$(node -e "import('./scripts/quality/validation-policy.mjs').then(({computePolicyHash}) => process.stdout.write(computePolicyHash()))")"
echo "tag_sha=${TAG_SHA}" >> "$GITHUB_OUTPUT"
echo "policy_hash=${POLICY_HASH}" >> "$GITHUB_OUTPUT"
node release-tooling/scripts/release/verify-certification.mjs --sha "${TAG_SHA}" --repo "${GITHUB_REPOSITORY}" --policy-hash "${POLICY_HASH}"
- name: Resolve explicit platform reuse
id: reuse
env:
VARVE_REUSE_RUN_ID: ${{ inputs.reuse_run_id }}
VARVE_REUSE_TARGETS: ${{ inputs.reuse_targets }}
run: node release-tooling/scripts/release/select-run-artifacts.mjs reuse-inputs
--windows '${{ steps.resolve.outputs.build_windows }}'
--macos '${{ steps.resolve.outputs.build_macos }}'
# ── 2. Certified-source gate ────────────────────────────────────────────────
gate:
name: Certified source gate
needs: preflight
# A publish-only dispatch operates on an already verified draft. Keep the
# expensive build graph out of that path; tag pushes and normal build
# dispatches still run the complete release validation.
if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish != 'yes'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.workflow_sha }}
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/scripts/release/certification.mjs
/scripts/release/verify-certification.mjs
/scripts/quality/validation-policy.mjs
- name: Recheck exact certification identity
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
node scripts/release/verify-certification.mjs \
--sha "${{ needs.preflight.outputs.tag_sha }}" \
--repo "${GITHUB_REPOSITORY}" \
--policy-hash "${{ needs.preflight.outputs.policy_hash }}"
# ── 2b. Signing preflight: validate credentials BEFORE any build ────────────
# The fail-closed principle, enforced before a single platform compiles:
# RELEASE_EXPECT_SIGNED=true makes platform certificates mandatory. Without
# that opt-in, stable and prerelease installers may ship explicitly unsigned;
# updater integrity signatures remain a separate requirement.
# Only PRESENCE BOOLEANS reach this job — secret values never enter it.
signing-preflight:
name: Signing preflight
needs: preflight
if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish != 'yes'
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
windows_mode: ${{ steps.policy.outputs.windows_mode }}
macos_mode: ${{ steps.policy.outputs.macos_mode }}
signing_required: ${{ steps.policy.outputs.signing_required }}
updater_mode: ${{ steps.policy.outputs.updater_mode }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ needs.preflight.outputs.tag }}
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/scripts/release/resolve-signing-policy.mjs
/scripts/release/signing-policy.mjs
/scripts/release/targets.mjs
- name: Resolve signing policy (presence booleans only)
id: policy
shell: bash
env:
CHANNEL: ${{ needs.preflight.outputs.channel }}
EXPECT_SIGNED: ${{ vars.RELEASE_EXPECT_SIGNED }}
PLATFORMS: >-
linux${{ needs.preflight.outputs.build_windows == 'true' && ' windows' || '' }}${{ needs.preflight.outputs.build_macos == 'true' && ' macos' || '' }}
P_APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE != '' }}
P_APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD != '' }}
P_APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY != '' }}
P_APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER != '' }}
P_APPLE_API_KEY: ${{ secrets.APPLE_API_KEY != '' }}
P_APPLE_API_KEY_P8_BASE64: ${{ secrets.APPLE_API_KEY_P8_BASE64 != '' }}
P_APPLE_ID: ${{ secrets.APPLE_ID != '' }}
P_APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD != '' }}
P_APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID != '' }}
P_AZURE_SIGNING_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID != '' }}
P_AZURE_SIGNING_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET != '' }}
P_AZURE_SIGNING_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID != '' }}
P_AZURE_SIGNING_ACCOUNT: ${{ vars.AZURE_SIGNING_ACCOUNT != '' }}
P_AZURE_SIGNING_PROFILE: ${{ vars.AZURE_SIGNING_PROFILE != '' }}
P_AZURE_SIGNING_ENDPOINT: ${{ vars.AZURE_SIGNING_ENDPOINT != '' }}
# Tauri updater signing is a separate trust layer from platform
# signing. Only its presence boolean reaches the policy resolver.
P_TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY != '' }}
run: |
POLICY="$(node scripts/release/resolve-signing-policy.mjs)"
echo "policy=${POLICY}"
echo "windows_mode=$(echo "${POLICY}" | node -e "process.stdin.on('data',d=>{const p=JSON.parse(d);process.stdout.write(p.windows)})")" >> "$GITHUB_OUTPUT"
echo "macos_mode=$(echo "${POLICY}" | node -e "process.stdin.on('data',d=>{const p=JSON.parse(d);process.stdout.write(p.macos)})")" >> "$GITHUB_OUTPUT"
W="$(echo "${POLICY}" | node -e "process.stdin.on('data',d=>{const p=JSON.parse(d);process.stdout.write(String(p.windows==='signed'||p.macos==='signed'))})")"
echo "signing_required=${W}" >> "$GITHUB_OUTPUT"
if [[ "${{ secrets.TAURI_SIGNING_PRIVATE_KEY != '' }}" == "true" ]]; then
echo "updater_mode=signed" >> "$GITHUB_OUTPUT"
else
echo "updater_mode=manual-only" >> "$GITHUB_OUTPUT"
fi
- name: Report policy outcome
shell: bash
run: |
{
echo "### Signing policy"
echo ""
echo "- Windows: **${{ steps.policy.outputs.windows_mode }}**"
echo "- macOS: **${{ steps.policy.outputs.macos_mode }}**"
echo "- Channel: ${{ needs.preflight.outputs.channel }}"
echo "- RELEASE_EXPECT_SIGNED: ${{ vars.RELEASE_EXPECT_SIGNED || '(unset)' }}"
echo "- Updater: **${{ steps.policy.outputs.updater_mode }}**"
} >> "$GITHUB_STEP_SUMMARY"
- name: Record manual-update contingency
shell: bash
env:
TAURI_KEY_PRESENT: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY != '' }}
run: |
if [[ "${TAURI_KEY_PRESENT}" != "true" ]]; then
echo "::warning::Updater signing key is absent; publishing manual-download installers without an updater feed."
echo "Platform signedness remains independently governed by RELEASE_EXPECT_SIGNED."
else
echo "Tauri updater signing key present (value never printed)."
fi
# Contracts use the tagged lockfile on every native architecture BEFORE
# compilation/reuse. A harness dependency failure must not consume a build.
native-contracts:
name: Native dependency contracts (${{ matrix.name }})
needs: [preflight, gate, signing-preflight]
if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish != 'yes'
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- name: linux-x86_64
os: ubuntu-22.04
node_arch: x64
enabled: true
- name: linux-aarch64
os: ubuntu-22.04-arm
node_arch: arm64
enabled: true
- name: windows-x86_64
os: windows-latest
node_arch: x64
enabled: ${{ needs.preflight.outputs.build_windows == 'true' }}
- name: windows-aarch64
os: windows-11-arm
node_arch: arm64
enabled: ${{ needs.preflight.outputs.build_windows == 'true' }}
- name: macos-aarch64
os: macos-latest
node_arch: arm64
enabled: ${{ needs.preflight.outputs.build_macos == 'true' }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
if: matrix.enabled
with:
ref: ${{ needs.preflight.outputs.tag }}
persist-credentials: false
- name: Checkout workflow-pinned native qualification tooling
if: matrix.enabled
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.workflow_sha }}
path: release-qualification-tooling
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/.github/workflows/release.yml
/scripts/release/production/
/scripts/release/targets.mjs
/scripts/release/verify-release-data.mjs
/scripts/is-main-module.mjs
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115
if: matrix.enabled
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
if: matrix.enabled
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- name: Install native qualification tooling dependencies
if: matrix.enabled
run: pnpm install --frozen-lockfile
- name: Record and verify actual native runtime
if: matrix.enabled
shell: bash
env:
EXPECTED_NODE_ARCH: ${{ matrix.node_arch }}
PRODUCT_SHA: ${{ needs.preflight.outputs.tag_sha }}
WORKFLOW_SHA: ${{ github.workflow_sha }}
NATIVE_RUNTIME_OUTPUT: ${{ runner.temp }}/native-runtime.json
run: |
node --input-type=module <<'NODE'
import assert from 'node:assert/strict';
import { createRequire } from 'node:module';
import { writeFileSync } from 'node:fs';
import { release } from 'node:os';
import { resolve } from 'node:path';
assert.equal(process.arch, process.env.EXPECTED_NODE_ARCH, 'Native Node architecture');
assert.equal(process.versions.node, process.env.NODE_VERSION, 'Exact qualification Node');
const owner = createRequire(resolve('packages/import/package.json'));
const pdfOwner = createRequire(owner.resolve('pdfjs-dist/legacy/build/pdf.mjs'));
const canvas = pdfOwner('@napi-rs/canvas');
assert.ok(canvas.createCanvas(2, 2).toBuffer('image/png').length > 0, 'Actual native canvas binary');
writeFileSync(process.env.NATIVE_RUNTIME_OUTPUT, JSON.stringify({
productSha: process.env.PRODUCT_SHA, workflowSha: process.env.WORKFLOW_SHA,
node: process.versions.node, platform: process.platform, arch: process.arch,
osRelease: release(), runnerImage: process.env.ImageOS ?? null,
runnerImageVersion: process.env.ImageVersion ?? null,
pdfjs: owner('pdfjs-dist/package.json').version,
canvas: pdfOwner('@napi-rs/canvas/package.json').version,
}, null, 2) + '\n');
NODE
- name: Native qualification adapter contracts
if: matrix.enabled
shell: bash
env:
VARVE_NATIVE_WORKFLOW_FIXTURE: release-qualification-tooling/.github/workflows/release.yml
run: |
node release-qualification-tooling/scripts/release/production/dialog-forwarding.test.mjs
node release-qualification-tooling/scripts/release/production/webdriver-dom.test.mjs
node release-qualification-tooling/scripts/release/production/native-quit.test.mjs
node release-qualification-tooling/scripts/release/production/native-export-controls.test.mjs
node release-qualification-tooling/scripts/release/production/native-pdf.test.mjs
node release-qualification-tooling/scripts/release/production/retained-document.test.mjs
node release-qualification-tooling/scripts/release/production/macos-ax-controls.test.mjs
node release-qualification-tooling/scripts/release/production/published-upgrade.test.mjs
node release-qualification-tooling/scripts/release/production/workflow.test.mjs
node release-qualification-tooling/scripts/release/production/session-options.test.mjs
- name: Preserve native runtime identity
if: always() && matrix.enabled
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9
with:
name: native-contract-${{ matrix.name }}-${{ github.run_id }}-attempt-${{ github.run_attempt }}
path: ${{ runner.temp }}/native-runtime.json
if-no-files-found: warn
retention-days: 14
# ── 3. Platform bundles on native runners ───────────────────────────────────
bundle:
name: Bundle (${{ matrix.name }})
needs: [preflight, gate, signing-preflight, native-contracts]
if: github.event_name != 'workflow_dispatch' || github.event.inputs.publish != 'yes'
timeout-minutes: 90
strategy:
fail-fast: false
max-parallel: 2
matrix:
include:
# ubuntu-22.04, NOT ubuntu-latest. This is the whole ballgame for Linux
# compatibility: a binary inherits the glibc symbol versions of the
# machine that linked it, and glibc is forward- but not
# backward-compatible.
#
# Measured against a real build (podman, ubuntu:22.04):
# built on CachyOS (glibc 2.44) -> requires GLIBC_2.39 -> refuses to
# exec on Ubuntu 22.04 with "version `GLIBC_2.39' not found".
#
# ubuntu-latest is 24.04 (glibc 2.39), so building there would produce
# exactly the same floor and silently exclude Ubuntu 22.04 LTS,
# Debian 12 and Fedora 38 — while the docs claimed 22.04 support.
# Building on 22.04 sets the floor at glibc 2.35 and those all work.
- name: linux-x86_64
os: ubuntu-22.04
os_slug: linux
arch_slug: x86_64
rust_target: x86_64-unknown-linux-gnu
executable: varve-desktop
bundles: appimage,deb,rpm
enabled: true
- name: linux-aarch64
os: ubuntu-22.04-arm
os_slug: linux
arch_slug: aarch64
rust_target: aarch64-unknown-linux-gnu
executable: varve-desktop
# AppImage cannot be cross-compiled by linuxdeploy; this must stay
# on a native ARM64 runner rather than being moved to QEMU.
bundles: appimage,deb,rpm
enabled: true
- name: windows-x86_64
os: windows-latest
os_slug: windows
arch_slug: x86_64
rust_target: x86_64-pc-windows-msvc
executable: varve-desktop.exe
bundles: nsis
enabled: ${{ needs.preflight.outputs.build_windows == 'true' }}
- name: windows-aarch64
os: windows-11-arm
os_slug: windows
arch_slug: aarch64
rust_target: aarch64-pc-windows-msvc
executable: varve-desktop.exe
# Tauri's NSIS bootstrapper is x86 and runs under emulation, but
# the installed Varve executable is native ARM64.
bundles: nsis
enabled: ${{ needs.preflight.outputs.build_windows == 'true' }}
- name: macos-aarch64
os: macos-latest
os_slug: macos
arch_slug: aarch64
rust_target: aarch64-apple-darwin
executable: varve-desktop
# ARM64 only, not universal: the bundled ONNX Runtime dylib has no
# macOS Intel build (scripts/fetch-onnxruntime.mjs PLATFORMS), so a
# "universal" DMG would be half-degraded. Audit H-3.
bundles: app,dmg
enabled: ${{ needs.preflight.outputs.build_macos == 'true' }}
runs-on: ${{ matrix.os }}
env:
REUSE_PLATFORM: ${{ contains(fromJSON(needs.preflight.outputs.reuse_targets), matrix.name) }}
# Public build-time configuration. App usage/diagnostics consent remains
# unknown until the user enables each category in Settings.
# Trust-boundary canary: present on the frontend build steps, then
# asserted absent from the final dist (see
# docs/security/trust-boundaries.md §Canary tests). Benign value with
# no credential meaning.
VARVE_PRIVATE_TEST_CANARY: VARVE_PRIVATE_TEST_CANARY_DO_NOT_SHIP
TAURI_TARGET_DIR: apps/desktop/src-tauri/target/${{ matrix.rust_target }}
TAURI_BUNDLE_DIR: apps/desktop/src-tauri/target/${{ matrix.rust_target }}/release/bundle
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
with:
# Bundled models (u2netp.onnx, realesr-general-x4v3.onnx) are
# committed directly, not Git LFS (LFS was retired 2026-08-20 —
# see .gitattributes — after the 980 MB ddcolor source exhausted
# the free-tier LFS bandwidth quota), so a normal checkout gets
# real weights. The large on-demand models (ddcolor 980 MB,
# ddcolor-tiny 220 MB, font-classify 64 MB) are downloaded at
# runtime and never touched here. The pointer guard below still
# fails the build loudly if a stray LFS pointer ever gets
# committed instead of real content.
ref: ${{ needs.preflight.outputs.tag }}
# Reuse is explicit and re-verifies producer identity and actual bytes.
# It skips compilation only; installed qualification and final trust run.
- name: Checkout workflow-pinned reuse tooling
if: matrix.enabled && env.REUSE_PLATFORM == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.workflow_sha }}
path: release-tooling
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/scripts/release/select-run-artifacts.mjs
/scripts/release/resume.mjs
/scripts/release/verify-windows-signature.ps1
/scripts/release/verify-macos-signature.sh
- name: Set up Node for retained artifacts
if: matrix.enabled && env.REUSE_PLATFORM == 'true'
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Select explicit successful reuse producer
id: reuse
if: matrix.enabled && env.REUSE_PLATFORM == 'true'
env:
GITHUB_TOKEN: ${{ github.token }}
run: node release-tooling/scripts/release/select-run-artifacts.mjs select-reuse
--repo '${{ github.repository }}' --run-id '${{ needs.preflight.outputs.reuse_run_id }}'
--sha '${{ github.workflow_sha }}' --source-sha '${{ needs.preflight.outputs.tag_sha }}'
--targets '${{ matrix.name }}'
- name: Download retained platform bytes
if: matrix.enabled && env.REUSE_PLATFORM == 'true'
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333
with:
artifact-ids: ${{ steps.reuse.outputs.artifact_ids }}
github-token: ${{ github.token }}
run-id: ${{ needs.preflight.outputs.reuse_run_id }}
path: retained-platform
- name: Recheck retained producer and tagged bytes
if: matrix.enabled && env.REUSE_PLATFORM == 'true'
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
node release-tooling/scripts/release/select-run-artifacts.mjs select-reuse \
--repo '${{ github.repository }}' --run-id '${{ needs.preflight.outputs.reuse_run_id }}' \
--sha '${{ github.workflow_sha }}' --source-sha '${{ needs.preflight.outputs.tag_sha }}' \
--targets '${{ matrix.name }}' --expected-artifact-id '${{ steps.reuse.outputs.artifact_ids }}'
node release-tooling/scripts/release/select-run-artifacts.mjs verify \
--dir retained-platform --version '${{ needs.preflight.outputs.version }}' \
--sha '${{ needs.preflight.outputs.tag_sha }}' --policy-hash '${{ needs.preflight.outputs.policy_hash }}' \
--targets '${{ matrix.name }}'
mkdir -p dist/release
cp -R retained-platform/. dist/release/
- name: Verify no bundled asset is a Git LFS pointer
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
run: node scripts/release/check-bundled-assets.mjs
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
with:
toolchain: 1.97.1
# diffusion-rs-sys formats generated bindings during compilation.
components: rustfmt
- name: Verify binding generator formatter
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
run: rustfmt --version
- name: Checkout workflow-pinned ARM64 compiler tooling
if: matrix.enabled && matrix.name == 'windows-aarch64' && env.REUSE_PLATFORM != 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
ref: ${{ github.workflow_sha }}
path: release-build-tooling
persist-credentials: false
sparse-checkout-cone-mode: false
sparse-checkout: |
/scripts/release/toolchains/windows-aarch64.cmake
/scripts/release/toolchains/verify-windows-aarch64.ps1
- name: Verify native Windows ARM64 Clang toolchain
id: arm64-compiler
if: matrix.enabled && matrix.name == 'windows-aarch64' && env.REUSE_PLATFORM != 'true'
shell: pwsh
run: ./release-build-tooling/scripts/release/toolchains/verify-windows-aarch64.ps1
- name: Verify native Rust linker from build shell
if: matrix.enabled && matrix.name == 'windows-aarch64' && env.REUSE_PLATFORM != 'true'
shell: bash
env:
ARM64_COMPILER_PROBE: ${{ steps.arm64-compiler.outputs.probe_dir }}
run: cargo run --offline --locked --release
--manifest-path "$ARM64_COMPILER_PROBE/rust/Cargo.toml"
- name: Install Linux system deps
if: matrix.enabled && runner.os == 'Linux' && env.REUSE_PLATFORM != 'true'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev libssl-dev \
libfontconfig1-dev libglib2.0-dev libsoup-3.0-dev \
libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev \
cmake pkg-config patchelf \
squashfs-tools xdg-utils
- name: Add Rust target
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
run: rustup target add ${{ matrix.rust_target }}
- uses: Swatinem/rust-cache@d1527c8f67ef9af357290475d4af4b0fab8f12e0
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
with:
key: bundle-${{ matrix.name }}-${{ needs.preflight.outputs.tag }}-${{ hashFiles('release-build-tooling/scripts/release/toolchains/**') }}
# Tauri is a standalone workspace with its own target directory.
# Preserve successfully compiled dependencies even if later linking
# or packaging fails; native acceptance still runs on actual bundles.
workspaces: |
. -> target
apps/desktop/src-tauri -> target
cache-on-failure: true
env-vars: CARGO CC CFLAGS CXX CMAKE RUST WindowsSDKVersion VCToolsInstallDir VARVE_WINDOWS_ARM64_CLANG
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
with:
version: ${{ env.PNPM_VERSION }}
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
- name: Build frontend
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
run: pnpm build
working-directory: apps/desktop
- name: Verify built dist has no LFS pointers
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
run: node scripts/release/check-bundled-assets.mjs --dist
# tauri.conf.json bundles onnxruntime-libs/** wholesale. A CI runner only
# fetches its own platform, so this is usually a no-op here — but it makes
# the bundle contents independent of what happens to be staged, which is
# what stops a 74 MB .deb from carrying 53.9 MB of macOS and Windows
# libraries the way a local build did.
- name: Fetch ONNX Runtime for target platform
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
run: node scripts/fetch-onnxruntime.mjs
- name: Prune foreign ONNX runtimes
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
run: node scripts/release/prune-foreign-runtimes.mjs
- name: Pin linuxdeploy-plugin-gtk
if: matrix.enabled && runner.os == 'Linux' && env.REUSE_PLATFORM != 'true'
run: node scripts/release/ensure-linuxdeploy-plugin-gtk.mjs --tools-dir "$HOME/.cache/tauri"
# ── macOS: import the Developer ID certificate into a temp keychain ──
# Only runs when the signing preflight resolved macos -> signed. The
# temporary keychain dies with the runner; nothing is uploaded.
# NOTE: the identity is matched exactly (APPLE_SIGNING_IDENTITY), never
# "the first codesigning identity in the keychain" — a wrong certificate
# type (e.g. Apple Development) must fail loudly here.
- name: Import Apple Developer ID certificate (temporary keychain)
if: matrix.enabled && runner.os == 'macOS' && needs.signing-preflight.outputs.macos_mode == 'signed' && env.REUSE_PLATFORM != 'true'
shell: bash
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
run: |
set -euo pipefail
KEYCHAIN_PASSWORD="$(openssl rand -base64 24)"
echo "${APPLE_CERTIFICATE}" | base64 --decode > /tmp/apple-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 /tmp/apple-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
rm -f /tmp/apple-certificate.p12
IDENTITIES="$(security find-identity -v -p codesigning build.keychain)"
echo "${IDENTITIES}"
if ! echo "${IDENTITIES}" | grep -q "${APPLE_SIGNING_IDENTITY}"; then
echo "::error::APPLE_SIGNING_IDENTITY not found in the temporary keychain."
echo "Expected: ${APPLE_SIGNING_IDENTITY}"
echo "This is usually a wrong certificate type (Developer ID Application is required for"
echo "direct distribution; Apple Development / Apple Distribution will not work)."
exit 1
fi
if ! echo "${APPLE_SIGNING_IDENTITY}" | grep -q '^Developer ID Application:'; then
echo "::error::APPLE_SIGNING_IDENTITY must start with 'Developer ID Application:' —"
echo "direct DMG distribution cannot use Apple Development or Apple Distribution identities."
exit 1
fi
# ── Windows: prepare the Artifact Signing sign command ──────────────
# Tauri runs bundle.windows.signCommand against the NSIS installer with
# the credentials in the process environment. The command itself contains
# NO secrets (endpoint/account/profile are non-secret configuration), so
# it is generated in CI from repository variables and merged at build time
# via `--config`. It is never committed (see .gitignore).
- name: Prepare Windows signing configuration
if: matrix.enabled && runner.os == 'Windows' && needs.signing-preflight.outputs.windows_mode == 'signed' && env.REUSE_PLATFORM != 'true'
shell: bash
env:
AZURE_SIGNING_ENDPOINT: ${{ vars.AZURE_SIGNING_ENDPOINT }}
AZURE_SIGNING_ACCOUNT: ${{ vars.AZURE_SIGNING_ACCOUNT }}
AZURE_SIGNING_PROFILE: ${{ vars.AZURE_SIGNING_PROFILE }}
run: |
set -euo pipefail
cat > apps/desktop/src-tauri/tauri.signing.windows.json <<EOF
{
"bundle": {
"windows": {
"signCommand": "artifact-signing-cli -e \"${AZURE_SIGNING_ENDPOINT}\" -a \"${AZURE_SIGNING_ACCOUNT}\" -c \"${AZURE_SIGNING_PROFILE}\" -d \"Varve installer\" %1"
}
}
}
EOF
- name: Install artifact-signing-cli (crates.io, pinned)
if: matrix.enabled && runner.os == 'Windows' && needs.signing-preflight.outputs.windows_mode == 'signed' && env.REUSE_PLATFORM != 'true'
run: cargo install artifact-signing-cli --version 0.11.0 --locked
# The App Store Connect API key (.p8) is decoded to a file BEFORE the
# build so APPLE_API_KEY_PATH resolves when Tauri notarizes.
- name: Write App Store Connect API key file
if: matrix.enabled && runner.os == 'macOS' && needs.signing-preflight.outputs.macos_mode == 'signed' && env.REUSE_PLATFORM != 'true'
shell: bash
env:
APPLE_API_KEY_P8_BASE64: ${{ secrets.APPLE_API_KEY_P8_BASE64 }}
run: |
set -euo pipefail
echo "${APPLE_API_KEY_P8_BASE64}" | base64 --decode > /tmp/varve-apple-api-key.p8
chmod 600 /tmp/varve-apple-api-key.p8
- name: Prepare updater channel configuration
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
shell: bash
env:
CHANNEL: ${{ needs.preflight.outputs.channel }}
UPDATER_MODE: ${{ needs.signing-preflight.outputs.updater_mode }}
run: |
node scripts/release/write-updater-config.mjs \
--channel "${CHANNEL}" \
--mode "${UPDATER_MODE}" \
--output apps/desktop/src-tauri/tauri.update.channel.json
- name: Tauri build (signed platforms)
if: matrix.enabled && (needs.signing-preflight.outputs.macos_mode == 'signed' || needs.signing-preflight.outputs.windows_mode == 'signed') && env.REUSE_PLATFORM != 'true'
shell: bash
env:
# Signing credentials are scoped to THIS step only — nothing is
# persisted through $GITHUB_ENV, so no later step (SBOM, checksums,
# artifact upload, failure diagnostics) can observe them.
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
APPLE_API_KEY_PATH: /tmp/varve-apple-api-key.p8
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_SIGNING_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_SIGNING_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_SIGNING_TENANT_ID }}
# This step legitimately holds signing credentials in the process
# environment (Tauri re-runs the frontend build via beforeBuildCommand).
# The client-env guard yields for the signing family ONLY with this
# flag set — it may appear in no other workflow (enforced by
# scripts/security/workflow-policy.mjs), and the resulting dist is
# re-scanned by the artifact scan step below.
VARVE_SIGNING_STEP_ALLOWED: '1'
NO_STRIP: '1'
VARVE_UPDATER_MODE: ${{ needs.signing-preflight.outputs.updater_mode }}
VARVE_UPDATE_CHANNEL: ${{ needs.preflight.outputs.channel }}
run: |
TAURI_EXTRA_ARGS="--config ${{ github.workspace }}/apps/desktop/src-tauri/tauri.update.channel.json"
if [[ "${{ runner.os }}" == "Windows" ]]; then
TAURI_EXTRA_ARGS+=" --config ${{ github.workspace }}/apps/desktop/src-tauri/tauri.signing.windows.json"
fi
pnpm tauri build --target ${{ matrix.rust_target }} --bundles ${{ matrix.bundles }} --ci ${TAURI_EXTRA_ARGS}
working-directory: apps/desktop
# Platform-unsigned builds still need the updater private key when the
# updater channel is signed. Platform signing and updater signing are
# separate trust layers: an unsigned Linux/Windows/macOS installer may
# still carry a verified Tauri updater signature. Keep OS certificate
# variables out of this step — Tauri treats a set APPLE_CERTIFICATE as a
# certificate to import, and an empty value would abort the macOS bundle
# (SecKeychainItemImport).
- name: Tauri build (unsigned platforms with signed updater)
if: matrix.enabled && needs.signing-preflight.outputs.macos_mode != 'signed' && needs.signing-preflight.outputs.windows_mode != 'signed' && needs.signing-preflight.outputs.updater_mode == 'signed' && env.REUSE_PLATFORM != 'true'
shell: bash
env:
# linuxdeploy bundles an old binutils `strip` that cannot parse the
# SHT_RELR (.relr.dyn) sections modern toolchains emit, and aborts the
# whole AppImage build with only "failed to run linuxdeploy" to show
# for it. Harmless to set everywhere: the Varve binary is stripped by
# [profile.release] strip = true, and distro libraries ship stripped.
NO_STRIP: '1'
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
# The updater key is needed by Tauri's beforeBuildCommand, which
# rebuilds the frontend in this process. The guard permits this
# exact signing family only for this short-lived build step, and the
# resulting dist is scanned again before collection.
VARVE_SIGNING_STEP_ALLOWED: '1'
VARVE_UPDATER_MODE: ${{ needs.signing-preflight.outputs.updater_mode }}
VARVE_UPDATE_CHANNEL: ${{ needs.preflight.outputs.channel }}
run: |
TAURI_EXTRA_ARGS="--config ${{ github.workspace }}/apps/desktop/src-tauri/tauri.update.channel.json"
if [[ "${{ runner.os }}" == "macOS" ]]; then
# Free ad-hoc bundle signature (signingIdentity: "-"). This is not
# Developer ID and must never be confused with paid Apple signing.
TAURI_EXTRA_ARGS+=" --config ${{ github.workspace }}/apps/desktop/src-tauri/tauri.signing.macos-adhoc.json"
fi
pnpm tauri build --target ${{ matrix.rust_target }} --bundles ${{ matrix.bundles }} --ci ${TAURI_EXTRA_ARGS}
working-directory: apps/desktop
# With no updater key, write the schema-valid inactive updater config and
# build a genuinely manual-download artifact. No signing material is
# present in this step at all.
- name: Tauri build (unsigned platforms, manual updates)
if: matrix.enabled && needs.signing-preflight.outputs.macos_mode != 'signed' && needs.signing-preflight.outputs.windows_mode != 'signed' && needs.signing-preflight.outputs.updater_mode != 'signed' && env.REUSE_PLATFORM != 'true'
shell: bash
env:
NO_STRIP: '1'
VARVE_UPDATER_MODE: ${{ needs.signing-preflight.outputs.updater_mode }}
VARVE_UPDATE_CHANNEL: ${{ needs.preflight.outputs.channel }}
run: |
TAURI_EXTRA_ARGS="--config ${{ github.workspace }}/apps/desktop/src-tauri/tauri.update.channel.json"
if [[ "${{ runner.os }}" == "macOS" ]]; then
TAURI_EXTRA_ARGS+=" --config ${{ github.workspace }}/apps/desktop/src-tauri/tauri.signing.macos-adhoc.json"
fi
pnpm tauri build --target ${{ matrix.rust_target }} --bundles ${{ matrix.bundles }} --ci ${TAURI_EXTRA_ARGS}
working-directory: apps/desktop
# ── Collect, rename, checksum, SBOM ────────────────────────────────
# The frontend dist embedded in the bundles was last produced by the
# Tauri build step above (beforeBuildCommand re-runs `pnpm build`).
# This is the definitive client artifact: it must never contain private
# configuration or the CI canary. Scan it before collection.
- name: Scan frontend dist (secret + canary)
if: matrix.enabled && env.REUSE_PLATFORM != 'true'
run: |
node scripts/secret-scan.mjs --dir apps/desktop/dist --canary "$VARVE_PRIVATE_TEST_CANARY"
# Keep WebKit/GTK in the AppImage; drop only the host GPU/EGL/Mesa
# stack so a clean VM can launch and a newer host Mesa is not
# shadowed. See scripts/release/prune-appimage-bundled-libs.mjs.
- name: Prune bundled libraries from AppImage
if: matrix.enabled && runner.os == 'Linux' && env.REUSE_PLATFORM != 'true'
run: |
node scripts/release/prune-appimage-bundled-libs.mjs \
--bundle-dir "${TAURI_BUNDLE_DIR}" \
--arch ${{ matrix.arch_slug }} \
--tools-dir "$HOME/.cache/tauri"
# firejail --appimage (AppImageHub) kernel-mounts the SquashFS and
# enforces mode bits. FUSE / --appimage-extract hide 0700 directories
# and 0770 AppRun.wrapped, so read the image with unsquashfs -lln.
- name: Verify AppImage squashfs permissions
if: matrix.enabled && runner.os == 'Linux' && env.REUSE_PLATFORM != 'true'
run: |
node scripts/release/verify-appimage-permissions.mjs \
--bundle-dir "${TAURI_BUNDLE_DIR}"
# linuxdeploy re-assembles the AppImage from a fresh squashfs, so
# the .sig produced by Tauri's build step is no longer valid.