-
Notifications
You must be signed in to change notification settings - Fork 11
1973 lines (1821 loc) · 92.5 KB
/
Copy pathrelease.yml
File metadata and controls
1973 lines (1821 loc) · 92.5 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
name: Release
run-name: Release / ${{ inputs.operation }} / ${{ github.ref_name }}
on:
workflow_dispatch:
inputs:
operation:
description: Prepare, dry-run, publish with trusted publishers, or bootstrap first registry versions
required: true
type: choice
default: prepare-release-pr
options:
- prepare-release-pr
- publish-dry-run
- publish
- publish-bootstrap
release_commit:
description: Optional full commit SHA assertion; when set it must equal the workflow commit
required: false
type: string
default: ""
continuation_pointer:
description: Internal exact-parent continuation pointer; leave empty for a maintainer dispatch
required: false
type: string
default: ""
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
CANONICAL_RELEASE_REPOSITORY: f0rr0/oliphaunt
NODE_VERSION: 22.22.3
NPM_VERSION: 11.18.0
PNPM_VERSION: 11.5.0
DENO_VERSION: v2.8.1
BUN_VERSION: 1.3.14
PUBLICATION_LOCK_PATH: target/release/publication-lock.json
BOOTSTRAP_LEDGER_PATH: target/release/bootstrap-ledger
# Normal publication and bootstrap each run within one hosted-runner window.
# Normal publication keeps enough time after registry writes for public
# consumer verification and GitHub draft promotion.
RELEASE_JOB_HARD_WINDOW_SECONDS: 21180
BOOTSTRAP_REGISTRY_MUTATION_WINDOW_SECONDS: 19800
POST_REGISTRY_RESERVE_SECONDS: 3240
# Public consumer lanes run concurrently under one 13-minute internal
# deadline and stop with ten minutes preserved for evidence, lock proof, and
# draft promotion. The enclosing workflow step has a 15-minute hard bound.
PUBLIC_CONSUMER_SMOKE_TIMEOUT_SECONDS: 780
PUBLIC_CONSUMER_FINALIZATION_RESERVE_SECONDS: 600
MAVEN_CENTRAL_NAMESPACE: dev.oliphaunt
concurrency:
# Every registry-writing or release-branch-writing operation shares one
# non-cancelling lock. GitHub permits one pending run while the active run
# completes, so maintainers must not stack mutation dispatches. Dry-runs are
# read-only and may run once per exact SHA.
group: release-${{ inputs.operation == 'publish-dry-run' && github.sha || 'mutation' }}
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
validate-inputs:
name: Validate release inputs
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
pull-requests: read
steps:
- name: Require canonical release repository
run: |
if [[ "${GITHUB_REPOSITORY}" != "${CANONICAL_RELEASE_REPOSITORY}" ]]; then
echo "Release workflow is pinned to ${CANONICAL_RELEASE_REPOSITORY}; got ${GITHUB_REPOSITORY}" >&2
exit 1
fi
- name: Checkout exact workflow commit
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
ref: ${{ github.sha }}
fetch-depth: 1
persist-credentials: false
- name: Validate release workflow inputs
id: validate_release_inputs
env:
RELEASE_OPERATION: ${{ inputs.operation }}
RELEASE_COMMIT: ${{ inputs.release_commit }}
RELEASE_CONTINUATION_POINTER: ${{ inputs.continuation_pointer }}
run: bash .github/scripts/validate-release-workflow-inputs.sh
- name: Set up pinned Node.js
id: setup_release_validation_node
if: ${{ inputs.operation == 'prepare-release-pr' }}
timeout-minutes: 3
uses: ./.github/actions/setup-node-runtime
with:
node-version: ${{ env.NODE_VERSION }}
- name: Require clear Release Please lifecycle
id: require_release_please_lifecycle
if: ${{ inputs.operation == 'prepare-release-pr' }}
timeout-minutes: 1
env:
GH_TOKEN: ${{ github.token }}
run: node tools/release/release-please-pr-lifecycle.mjs assert-clean --base main
prepare-release-pr:
name: Prepare release PR
needs: validate-inputs
runs-on: ubuntu-24.04
timeout-minutes: 20
if: ${{ inputs.operation == 'prepare-release-pr' }}
environment: release-pr
permissions:
contents: write
issues: write
pull-requests: write
steps:
- name: Require main
run: |
if [[ "${GITHUB_REF}" != "refs/heads/main" ]]; then
echo "Releases must be run from main; got ${GITHUB_REF}" >&2
exit 1
fi
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Require current main
id: require_current_main
timeout-minutes: 1
run: bash .github/scripts/require-current-main.sh "$GITHUB_SHA"
- name: Require release PR token
env:
RELEASE_PR_TOKEN: ${{ secrets.RELEASE_PR_TOKEN }}
run: |
if [[ -z "${RELEASE_PR_TOKEN}" ]]; then
echo "RELEASE_PR_TOKEN is required so generated release PRs trigger normal PR CI." >&2
echo "Configure a GitHub App or maintainer bot token in the release-pr environment." >&2
exit 1
fi
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
install-workspace: "true"
- name: Set up Rust
uses: ./.github/actions/setup-rust
- name: Validate release metadata
run: |
tools/dev/bun.sh tools/release/release-check.mjs
- name: Create or update release-please PR
id: release_please
uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071
with:
token: ${{ secrets.RELEASE_PR_TOKEN }}
target-branch: main
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
skip-github-release: true
- name: Sync derived release PR files
id: sync_release_pr
env:
GH_TOKEN: ${{ secrets.RELEASE_PR_TOKEN }}
RELEASE_PLEASE_PR: ${{ steps.release_please.outputs.pr }}
RELEASE_PLEASE_PRS: ${{ steps.release_please.outputs.prs }}
RELEASE_PLEASE_PRS_CREATED: ${{ steps.release_please.outputs.prs_created }}
run: |
set -euo pipefail
release_pr_number="$(bun .github/scripts/resolve-release-please-pr.mjs)"
if [[ -z "${release_pr_number}" ]]; then
release_pr_number="$(
gh pr list \
--base main \
--head release-please--branches--main \
--state open \
--json number \
--jq '.[0].number // empty'
)"
fi
if [[ -z "${release_pr_number}" ]]; then
if [[ "${RELEASE_PLEASE_PRS_CREATED}" == "true" ]]; then
echo "release-please reported PR changes, but no release PR number could be resolved." >&2
exit 1
fi
shared_contrib_status="$(
tools/dev/bun.sh tools/release/sync-release-pr.mjs --shared-contrib-status
)"
if [[ "${shared_contrib_status}" != "required=true" ]]; then
echo "No open release-please PR or unreleased shared contrib source change found."
exit 0
fi
release_pr_branch="release-please--branches--main"
release_pr_title="chore(release): prepare main releases"
gh auth setup-git
bash .github/scripts/require-current-main.sh "$GITHUB_SHA"
git switch -c "${release_pr_branch}"
tools/dev/bun.sh tools/release/sync-release-pr.mjs --bootstrap-shared-contrib
if [[ -n "$(git ls-files --others --exclude-standard)" ]]; then
echo "Shared contrib release bootstrap created untracked files." >&2
git status --short >&2
exit 1
fi
git config user.name "oliphaunt-release-bot"
git config user.email "oliphaunt-release-bot@users.noreply.github.com"
git add -u
if git diff --cached --quiet --exit-code; then
echo "Shared contrib release bootstrap produced no release candidate." >&2
exit 1
fi
git commit -m "${release_pr_title}"
tools/dev/bun.sh tools/release/sync-release-pr.mjs --check
git push --set-upstream origin "${release_pr_branch}"
gh pr create \
--base main \
--head "${release_pr_branch}" \
--title "${release_pr_title}" \
--label "autorelease: pending" \
--body "Runtime release candidates derived from shared PostgreSQL contrib carrier source changes."
release_pr_number="$(
gh pr view "${release_pr_branch}" --json number --jq '.number'
)"
echo "shared_contrib_pr_created=true" >> "$GITHUB_OUTPUT"
fi
IFS=$'\t' read -r \
release_pr_observed_number \
release_pr_base \
release_pr_head \
release_pr_old_sha \
release_pr_head_repository \
release_pr_is_cross_repository \
release_pr_state \
release_pr_title \
<<<"$(
gh pr view "${release_pr_number}" \
--json number,baseRefName,headRefName,headRefOid,headRepository,isCrossRepository,state,title \
--jq '[.number, .baseRefName, .headRefName, .headRefOid, .headRepository.nameWithOwner, (.isCrossRepository | tostring), .state, .title] | @tsv'
)"
gh auth setup-git
bash .github/scripts/require-current-main.sh "$GITHUB_SHA"
release_pr_identity_args=(
--pr-number "${release_pr_number}"
--observed-pr-number "${release_pr_observed_number}"
--base "${release_pr_base}"
--head "${release_pr_head}"
--head-sha "${release_pr_old_sha}"
--head-repository "${release_pr_head_repository}"
--cross-repository "${release_pr_is_cross_repository}"
--state "${release_pr_state}"
--title "${release_pr_title}"
--main-sha "$GITHUB_SHA"
)
bun .github/scripts/normalize-release-please-pr.mjs \
normalize \
"${release_pr_identity_args[@]}"
tools/dev/bun.sh tools/release/sync-release-pr.mjs
tools/dev/bun.sh tools/release/sync-release-pr.mjs --check
if [[ -n "$(git ls-files --others --exclude-standard)" ]]; then
echo "Derived release synchronization created untracked files; refusing an incomplete amend." >&2
git status --short >&2
exit 1
fi
git config user.name "oliphaunt-release-bot"
git config user.email "oliphaunt-release-bot@users.noreply.github.com"
if [[ -n "$(git status --porcelain --untracked-files=no)" ]]; then
git add -u
git commit --amend --no-edit
else
echo "Derived release files already match the normalized Release Please tree."
fi
release_products_json="$(
tools/dev/bun.sh tools/release/verify-release-commit.mjs \
--derive-products \
--head-ref HEAD
)"
tools/dev/bun.sh tools/release/verify-release-commit.mjs \
--products-json "${release_products_json}" \
--head-ref HEAD
tools/dev/bun.sh tools/release/release-metadata-check.mjs
bun .github/scripts/normalize-release-please-pr.mjs \
push \
"${release_pr_identity_args[@]}"
- name: Report release-please PR result
env:
RELEASE_PLEASE_PRS_CREATED: ${{ steps.release_please.outputs.prs_created }}
SHARED_CONTRIB_PR_CREATED: ${{ steps.sync_release_pr.outputs.shared_contrib_pr_created }}
run: |
if [[ "${RELEASE_PLEASE_PRS_CREATED}" == "true" || "${SHARED_CONTRIB_PR_CREATED}" == "true" ]]; then
echo "A release PR was created or updated."
else
echo "release-please found no releasable changes."
fi
publish-dry-run:
name: Prepare release dry run
needs:
- validate-inputs
runs-on: macos-26
timeout-minutes: 360
if: ${{ inputs.operation == 'publish-dry-run' }}
environment: release-dry-run
permissions:
actions: read
contents: read
steps: &release_candidate_steps
- name: Record release deadline
id: release_job_deadline
if: ${{ inputs.operation == 'publish' }}
run: |
if [[ ! "$RELEASE_JOB_HARD_WINDOW_SECONDS" =~ ^[1-9][0-9]*$ ]]; then
echo 'RELEASE_JOB_HARD_WINDOW_SECONDS must be a positive integer' >&2
exit 1
fi
hard_deadline=$(( $(date +%s) + RELEASE_JOB_HARD_WINDOW_SECONDS ))
{
echo "RELEASE_JOB_HARD_DEADLINE_EPOCH=$hard_deadline"
echo "OLIPHAUNT_GITHUB_CONTENT_WRITE_COLD_START_EPOCH=$(date +%s)"
echo "OLIPHAUNT_GITHUB_CONTENT_WRITE_PACER_PATH=$RUNNER_TEMP/oliphaunt-github-content-write-pacer.json"
echo "OLIPHAUNT_GITHUB_CORE_REQUEST_JOURNAL_PATH=$RUNNER_TEMP/oliphaunt-github-core-request-journal.json"
echo "OLIPHAUNT_REQUIRE_GITHUB_CORE_REQUEST_JOURNAL=true"
echo "OLIPHAUNT_GITHUB_RUN_SNAPSHOT_DIR=$RUNNER_TEMP/oliphaunt-github-run-snapshots"
} >> "$GITHUB_ENV"
echo "The release must finish before Unix time $hard_deadline."
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0
persist-credentials: false
- name: Resolve release commit
id: release_head
timeout-minutes: 1
env:
INPUT_RELEASE_COMMIT: ${{ inputs.release_commit }}
run: .github/scripts/resolve-release-head.sh
- name: Set up pinned Node.js
id: setup_github_stage_node
timeout-minutes: 3
uses: ./.github/actions/setup-node-runtime
with:
node-version: ${{ env.NODE_VERSION }}
- name: Set up Moon
uses: ./.github/actions/setup-moon
with:
install-workspace: "true"
- name: Set up Rust
uses: ./.github/actions/setup-rust
- name: Configure macOS release toolchains
id: configure_release_candidate_toolchains
run: bash .github/scripts/configure-macos-release-toolchains.sh --android
- name: Validate release metadata
run: |
tools/dev/bun.sh tools/release/release-check.mjs
- name: Plan product releases
id: release_plan
run: |
release_plan_args=(
--from-product-tags
--include-current-tags
--head-ref "$RELEASE_HEAD_SHA"
--format github-output
)
tools/dev/bun.sh tools/release/release_plan.mjs "${release_plan_args[@]}" >> "$GITHUB_OUTPUT"
- name: No package release planned
if: ${{ steps.release_plan.outputs.has_release_changes != 'true' }}
run: echo "No release-affecting product changes were found since the last product tag."
- name: Resolve selected registry authentication needs
id: registry_needs
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' }}
env:
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
run: bun .github/scripts/selected-registry-needs.mjs
- name: Verify direct-workflow OIDC identity
id: verify_oidc_identity
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' }}
env:
RELEASE_OPERATION: ${{ inputs.operation }}
run: bun .github/scripts/verify-github-oidc-identity.mjs
- name: Prove workflow HEAD is the release commit
id: verify_publication_candidate
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' }}
timeout-minutes: 2
env:
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
run: |
tools/dev/bun.sh tools/release/verify-publication-candidate.mjs \
--products-json "$PRODUCTS_JSON" \
--head-ref "$RELEASE_HEAD_SHA" \
--github-output "$GITHUB_OUTPUT"
- name: Prove Release Please PR can complete after publication
id: assert_release_please_markable
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' }}
timeout-minutes: 1
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tools/dev/bun.sh tools/release/release-please-pr-lifecycle.mjs \
assert-markable \
--release-sha "${{ steps.verify_publication_candidate.outputs.release_sha }}" \
--base main
- name: Preflight selected product tag and release collisions
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
run: |
gh auth setup-git
tools/dev/bun.sh tools/release/verify_product_tags.mjs \
--products-json "$PRODUCTS_JSON" \
--target "$RELEASE_HEAD_SHA" \
--allow-missing
bun .github/scripts/manage-release-drafts.mjs preflight \
--products-json "$PRODUCTS_JSON" \
--head-ref "$RELEASE_HEAD_SHA"
- name: Check publish environment
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: tools/release/check_publish_environment.mjs --products-json "${PRODUCTS_JSON}"
- name: Verify external registry ownership and trust links
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' }}
env:
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
run: bun .github/scripts/verify-external-publish-readiness.mjs
- name: Import, sign, and verify Maven credentials before mutation
id: verify_maven_signing
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' && steps.registry_needs.outputs.needs_maven == 'true' }}
timeout-minutes: 2
env:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: tools/dev/bun.sh tools/release/verify-maven-signing-readiness.mjs
- name: Require qualified release-commit CI run
id: ci_qualification
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
RELEASE_OPERATION: ${{ inputs.operation }}
REQUIRES_WASIX_EVIDENCE: ${{ steps.release_plan.outputs.requires_wasix_release_regression_evidence }}
run: |
qualification_timeout=7200
if [[ "$RELEASE_OPERATION" != publish-dry-run ]]; then
qualification_timeout=0
fi
qualification_args=(
CI
"$RELEASE_HEAD_SHA"
"$qualification_timeout"
--event push
--event workflow_dispatch
--job Builds
--job Required
--job Qualified
--artifact artifact-build-plan
--artifact oliphaunt-release-candidate
)
if [[ "$REQUIRES_WASIX_EVIDENCE" == true ]]; then
qualification_args+=(--artifact wasix-release-regression-evidence)
fi
if [[ "${{ steps.release_plan.outputs.has_extension_artifacts }}" == true ]]; then
qualification_args+=(--artifact oliphaunt-extension-package-artifacts)
fi
bash .github/scripts/require-workflow-success.sh "${qualification_args[@]}"
- name: Download exact-SHA qualification record
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
run: |
node .github/scripts/download-build-artifacts.mjs \
CI \
"$RELEASE_HEAD_SHA" \
target/release-candidate \
--run-id "$CI_RUN_ID" \
--job Qualified \
--artifact oliphaunt-release-candidate
- name: Download exact-SHA affected plan
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
run: |
node .github/scripts/download-build-artifacts.mjs \
CI \
"$RELEASE_HEAD_SHA" \
target/release-candidate/affected-plan \
--run-id "$CI_RUN_ID" \
--job Plan \
--artifact artifact-build-plan
- name: Download required exact-SHA WASIX evidence
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && steps.release_plan.outputs.requires_wasix_release_regression_evidence == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
run: |
node .github/scripts/download-build-artifacts.mjs \
CI \
"$RELEASE_HEAD_SHA" \
target/release-candidate/wasix-evidence \
--run-id "$CI_RUN_ID" \
--job "E2E / WASIX release regression" \
--artifact wasix-release-regression-evidence
- name: Verify exact-SHA qualification record
id: verify_qualification
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' }}
env:
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
WASIX_EVIDENCE_REQUIRED: ${{ steps.release_plan.outputs.requires_wasix_release_regression_evidence }}
run: |
node .github/scripts/verify-release-candidate.mjs \
target/release-candidate/oliphaunt-release-candidate.json \
--plan target/release-candidate/affected-plan/ci-plan.json \
--qualification-mode full-payload \
--wasix-evidence-required "$WASIX_EVIDENCE_REQUIRED" \
--wasix-evidence-root target/release-candidate/wasix-evidence
- name: Require one approved dry-run lock and capsule
id: approved_publication_lock
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
approved_artifacts=(
--artifact oliphaunt-publication-lock
--artifact oliphaunt-bootstrap-capsule
)
gate_output="$RUNNER_TEMP/approved-publication-inputs-gate.out"
GITHUB_OUTPUT="$gate_output" \
bash .github/scripts/require-workflow-success.sh \
Release \
"$RELEASE_HEAD_SHA" \
300 \
--event workflow_dispatch \
"${approved_artifacts[@]}"
cat "$gate_output" >> "$GITHUB_OUTPUT"
- name: Download prior approved publication lock
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
RELEASE_LOCK_RUN_ID: ${{ steps.approved_publication_lock.outputs.run_id }}
APPROVED_ARTIFACT_METADATA_JSON: ${{ steps.approved_publication_lock.outputs.artifact_metadata_json }}
run: |
node .github/scripts/download-build-artifacts.mjs \
Release \
"$RELEASE_HEAD_SHA" \
target/approved-publication-lock \
--run-id "$RELEASE_LOCK_RUN_ID" \
--artifact-metadata-json "$APPROVED_ARTIFACT_METADATA_JSON" \
--artifact oliphaunt-publication-lock
- name: Validate product versions and registry state
id: validate_release_registry_state
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
run: |
tools/dev/bun.sh tools/release/release-check-registries.mjs \
--products-json "$PRODUCTS_JSON" \
--head-ref "$RELEASE_HEAD_SHA"
- name: Download WASIX runtime build artifacts
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && contains(fromJson(steps.release_plan.outputs.products_json), 'liboliphaunt-wasix') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
RELEASE_ARTIFACT_SHA: ${{ steps.release_head.outputs.sha }}
run: bun .github/scripts/download-wasix-runtime-build-artifacts.mjs
- name: Download WASIX release assets
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && contains(fromJson(steps.release_plan.outputs.products_json), 'liboliphaunt-wasix') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
RELEASE_ARTIFACT_SHA: ${{ steps.release_head.outputs.sha }}
run: |
node .github/scripts/download-build-artifacts.mjs \
CI \
"$RELEASE_ARTIFACT_SHA" \
target/oliphaunt-wasix/release-assets \
--run-id "$CI_RUN_ID" \
--job Builds \
--artifact liboliphaunt-wasix-release-assets
- name: Download exact-extension package artifacts
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && steps.release_plan.outputs.has_extension_artifacts == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
RELEASE_ARTIFACT_SHA: ${{ steps.release_head.outputs.sha }}
run: |
node .github/scripts/download-build-artifacts.mjs \
CI \
"$RELEASE_ARTIFACT_SHA" \
target/extension-artifacts \
--run-id "$CI_RUN_ID" \
--job Builds \
--artifact oliphaunt-extension-package-artifacts
- name: Download SDK package artifacts
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
RELEASE_ARTIFACT_SHA: ${{ steps.release_head.outputs.sha }}
run: |
download_sdk_artifact() {
local product="$1"
local artifact_args=()
while IFS= read -r artifact; do
artifact_args+=(--artifact "$artifact")
done < <(tools/dev/bun.sh tools/release/release_graph_query.mjs ci-artifact-names --product "$product" --family sdk-package --format lines)
node .github/scripts/download-build-artifacts.mjs \
CI \
"$RELEASE_ARTIFACT_SHA" \
"target/sdk-artifacts/$product" \
--run-id "$CI_RUN_ID" \
--job Builds \
"${artifact_args[@]}"
}
while IFS= read -r product; do
download_sdk_artifact "$product"
done < <(tools/dev/bun.sh tools/release/release_graph_query.mjs ci-products --family sdk-package --products-json "$PRODUCTS_JSON" --format lines)
- name: Download liboliphaunt release assets
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && contains(fromJson(steps.release_plan.outputs.products_json), 'liboliphaunt-native') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
RELEASE_ARTIFACT_SHA: ${{ steps.release_head.outputs.sha }}
run: |
node .github/scripts/download-build-artifacts.mjs \
CI \
"$RELEASE_ARTIFACT_SHA" \
target/liboliphaunt/release-assets \
--run-id "$CI_RUN_ID" \
--job Builds \
--artifact liboliphaunt-native-release-assets
- name: Set up Deno for TypeScript JSR consumer checks
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && contains(fromJson(steps.release_plan.outputs.products_json), 'oliphaunt-js') }}
uses: ./.github/actions/setup-deno
with:
deno-version: ${{ env.DENO_VERSION }}
- name: Set up Bun for TypeScript npm consumer checks
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && contains(fromJson(steps.release_plan.outputs.products_json), 'oliphaunt-js') }}
uses: ./.github/actions/setup-bun
with:
bun-version: ${{ env.BUN_VERSION }}
- name: Install TypeScript release tooling
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && contains(fromJson(steps.release_plan.outputs.products_json), 'oliphaunt-js') }}
run: pnpm install --frozen-lockfile
- name: Download native helper release assets
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && (contains(fromJson(steps.release_plan.outputs.products_json), 'oliphaunt-broker') || contains(fromJson(steps.release_plan.outputs.products_json), 'oliphaunt-node-direct')) }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
PRODUCT_OLIPHAUNT_BROKER: ${{ contains(fromJson(steps.release_plan.outputs.products_json), 'oliphaunt-broker') }}
PRODUCT_OLIPHAUNT_NODE_DIRECT: ${{ contains(fromJson(steps.release_plan.outputs.products_json), 'oliphaunt-node-direct') }}
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
RELEASE_ARTIFACT_SHA: ${{ steps.release_head.outputs.sha }}
run: |
download_helper_artifacts() {
local product="$1"
local kind="$2"
local destination="$3"
local artifact_args=()
while IFS= read -r artifact; do
artifact_args+=(--artifact "$artifact")
done < <(tools/dev/bun.sh tools/release/release_graph_query.mjs ci-artifact-names --product "$product" --kind "$kind" --family release-assets --format lines)
node .github/scripts/download-build-artifacts.mjs \
CI \
"$RELEASE_ARTIFACT_SHA" \
"$destination" \
--run-id "$CI_RUN_ID" \
--job Builds \
"${artifact_args[@]}"
}
if [ "$PRODUCT_OLIPHAUNT_BROKER" = "true" ]; then
download_helper_artifacts \
oliphaunt-broker \
broker-helper \
target/oliphaunt-broker/release-assets
fi
if [ "$PRODUCT_OLIPHAUNT_NODE_DIRECT" = "true" ]; then
download_helper_artifacts \
oliphaunt-node-direct \
node-direct-addon \
target/oliphaunt-node-direct/release-assets
fi
- name: Download Node direct optional npm packages
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && contains(fromJson(steps.release_plan.outputs.products_json), 'oliphaunt-node-direct') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
RELEASE_ARTIFACT_SHA: ${{ steps.release_head.outputs.sha }}
run: |
artifact_args=()
while IFS= read -r artifact; do
artifact_args+=(--artifact "$artifact")
done < <(tools/dev/bun.sh tools/release/release_graph_query.mjs ci-artifact-names --product oliphaunt-node-direct --kind node-direct-addon --family npm-package --format lines)
node .github/scripts/download-build-artifacts.mjs \
CI \
"$RELEASE_ARTIFACT_SHA" \
target/oliphaunt-node-direct/npm-packages \
--run-id "$CI_RUN_ID" \
--job Builds \
"${artifact_args[@]}"
- name: Freeze canonical Apple extension carrier input
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && (contains(fromJson(steps.release_plan.outputs.products_json), 'oliphaunt-swift') || contains(fromJson(steps.release_plan.outputs.products_json), 'oliphaunt-react-native')) }}
env:
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
run: |
includes_swift="$(bun -e 'console.log(JSON.parse(process.argv[1]).includes("oliphaunt-swift"))' "$PRODUCTS_JSON")"
includes_react_native="$(bun -e 'console.log(JSON.parse(process.argv[1]).includes("oliphaunt-react-native"))' "$PRODUCTS_JSON")"
swift_source_carrier=target/sdk-artifacts/oliphaunt-swift/release-tree/src/sdks/swift/Carriers/oliphaunt-react-native-ios-carriers.json
react_native_source_carrier=target/sdk-artifacts/oliphaunt-react-native/ios-carriers/oliphaunt-react-native-ios-carriers.json
extension_manifest_args=()
extension_carrier_args=()
while IFS= read -r product_root; do
product="$(basename "$product_root")"
manifest="$product_root/extension-artifacts.json"
if [[ ! -f "$manifest" ]]; then
echo "Selected extension product $product is missing $manifest" >&2
exit 1
fi
extension_manifest_args+=(--extension-manifest "$manifest")
product_carriers=()
while IFS= read -r carrier; do
product_carriers+=("$carrier")
done < <(find "$product_root/release-assets" -maxdepth 1 -type f -name '*-swift-extension-carrier.json' | LC_ALL=C sort)
if (( ${#product_carriers[@]} != 1 )); then
echo "Selected extension product $product must provide exactly one independent Swift carrier; found ${#product_carriers[@]}" >&2
exit 1
fi
extension_carrier_args+=(--extension-carrier "${product_carriers[0]}")
done < <(tools/dev/bun.sh tools/release/release_graph_query.mjs \
ci-products \
--family extension-artifacts \
--carrier-family native \
--products-json "$PRODUCTS_JSON" \
--field artifact-root \
--format lines)
rm -rf target/release/ios-carriers target/release-work/ios-carriers
if [[ "$includes_swift" == true && "$includes_react_native" == true ]] && ! cmp -s "$swift_source_carrier" "$react_native_source_carrier"; then
echo 'Swift and React Native source carriers disagree for the same release plan.' >&2
diff --unified "$swift_source_carrier" "$react_native_source_carrier" || true
exit 1
fi
if [[ "$includes_react_native" == true ]]; then
mkdir -p target/release/ios-carriers
public_args=(
--base-carrier "$react_native_source_carrier"
"${extension_manifest_args[@]}"
--output target/release/ios-carriers/oliphaunt-react-native-ios-carriers.json
)
tools/dev/bun.sh tools/release/ios-carrier-manifest.mjs "${public_args[@]}"
fi
if [[ "$includes_swift" == true && ${#extension_manifest_args[@]} -gt 0 ]]; then
mkdir -p target/release-work/ios-carriers
local_aggregate_carrier=target/release-work/ios-carriers/oliphaunt-react-native-ios-carriers.json
local_args=(
--base-carrier "$swift_source_carrier"
"${extension_manifest_args[@]}"
--output "$local_aggregate_carrier"
--local-urls
)
tools/dev/bun.sh tools/release/ios-carrier-manifest.mjs "${local_args[@]}"
extensions_csv="$(bun -e '
const manifest = JSON.parse(await Bun.file(process.argv[1]).text());
console.log(manifest.extensions.map((row) => row.sqlName).sort().join(","));
' "$local_aggregate_carrier")"
if [[ -z "$extensions_csv" || ${#extension_carrier_args[@]} == 0 ]]; then
echo 'Swift extension validation requires selected extension carrier assets.' >&2
exit 1
fi
swift_version="$(tools/dev/bun.sh tools/release/product-version.mjs version oliphaunt-swift)"
cache=target/release-work/swiftpm-extension-cache
node src/sdks/swift/tools/render-extension-products.mjs \
--carrier "$local_aggregate_carrier" \
--extensions "$extensions_csv" \
--cache-dir "$cache" \
--allow-file-urls \
--base-package-version "$swift_version" \
--output-dir target/release-work/swiftpm-extension-cache-warm
node src/sdks/swift/tools/render-extension-products.mjs \
--carrier "$swift_source_carrier" \
"${extension_carrier_args[@]}" \
--extensions "$extensions_csv" \
--cache-dir "$cache" \
--offline \
--base-package-version "$swift_version" \
--output-dir target/release/swiftpm-extension-consumer-fixture
fi
- name: Set up pinned npm publisher
id: setup_github_stage_npm
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && steps.registry_needs.outputs.needs_npm == 'true' }}
timeout-minutes: 3
uses: ./.github/actions/setup-npm-publisher
with:
npm-version: ${{ env.NPM_VERSION }}
- name: Validate selected release
id: validate_release
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' }}
env:
CI_RUN_ID: ${{ steps.ci_qualification.outputs.run_id }}
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
WASIX_EVIDENCE_REQUIRED: ${{ steps.release_plan.outputs.requires_wasix_release_regression_evidence }}
run: tools/dev/bun.sh tools/release/release-publish.mjs publish-dry-run --qualified-ci --products-json "${PRODUCTS_JSON}" --head-ref "$RELEASE_HEAD_SHA"
- name: Package public release carriers
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' }}
env:
OLIPHAUNT_BROKER_RELEASE_ASSET_INPUT_DIRS: ${{ github.workspace }}/target/oliphaunt-broker/release-assets
OLIPHAUNT_NODE_ADDON_ASSET_INPUT_DIRS: ${{ github.workspace }}/target/oliphaunt-node-direct/release-assets
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
run: tools/dev/bun.sh tools/release/package-release-carriers.mjs --products-json "$PRODUCTS_JSON"
- name: Freeze exhaustive publication lock
id: freeze_publication_lock
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' }}
env:
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
run: |
lock_args=(
create
--products-json "$PRODUCTS_JSON"
--head-ref "$RELEASE_HEAD_SHA"
--output target/release/publication-lock.json
)
for artifact_root in \
target/release \
target/sdk-artifacts \
target/liboliphaunt/release-assets \
target/liboliphaunt/cargo-artifacts \
target/oliphaunt-wasix/release-assets \
target/oliphaunt-broker/release-assets \
target/oliphaunt-broker/cargo-artifacts \
target/oliphaunt-wasix/cargo-artifacts \
target/oliphaunt-node-direct/release-assets \
target/oliphaunt-node-direct/npm-packages; do
if [[ -e "$artifact_root" ]]; then
lock_args+=(--artifact-root "$artifact_root")
fi
done
while IFS= read -r artifact_root; do
if [[ ! -d "$artifact_root" ]]; then
echo "Selected extension artifacts are missing $artifact_root" >&2
exit 1
fi
lock_args+=(--artifact-root "$artifact_root")
done < <(tools/dev/bun.sh tools/release/release_graph_query.mjs \
ci-products \
--family extension-artifacts \
--products-json "$PRODUCTS_JSON" \
--field artifact-root \
--format lines)
tools/dev/bun.sh tools/release/publication-lock.mjs "${lock_args[@]}"
tools/dev/bun.sh tools/release/publication-lock.mjs \
verify \
--lock target/release/publication-lock.json \
--head-ref "$RELEASE_HEAD_SHA"
- name: Match prior approved publication lock
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' }}
run: |
approved_lock=target/approved-publication-lock/publication-lock.json
if ! cmp -s "$approved_lock" "$PUBLICATION_LOCK_PATH"; then
echo 'publication lock differs from the prior approved dry-run lock' >&2
diff --unified "$approved_lock" "$PUBLICATION_LOCK_PATH" || true
exit 1
fi
echo 'publication lock exactly matches the prior approved dry-run lock'
- name: Assemble and sign the exact Maven Central bundle before release mutation
id: preflight_maven_bundle
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' && steps.registry_needs.outputs.needs_maven == 'true' }}
timeout-minutes: 15
env:
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
run: |
tools/dev/bun.sh tools/release/preflight-maven-central-bundle.mjs \
--publication-lock "$PUBLICATION_LOCK_PATH" \
--products-json "$PRODUCTS_JSON" \
--release-commit "$RELEASE_HEAD_SHA"
- name: Prove the exact SwiftPM source tag is remotely collision-free
id: preflight_swift_source_tag
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' && contains(fromJson(steps.release_plan.outputs.products_json), 'oliphaunt-swift') }}
timeout-minutes: 2
run: |
tools/dev/bun.sh tools/release/preflight-swiftpm-source-tag.mjs \
--publication-lock "$PUBLICATION_LOCK_PATH" \
--release-commit "$RELEASE_HEAD_SHA"
- name: Classify pre-tag registry publication state
id: bootstrap_ledger_state
if: ${{ steps.release_plan.outputs.has_release_changes == 'true' && inputs.operation == 'publish' && (steps.registry_needs.outputs.needs_cargo == 'true' || steps.registry_needs.outputs.needs_npm == 'true') }}
env:
PRODUCTS_JSON: ${{ steps.release_plan.outputs.products_json }}
RELEASE_HEAD_SHA: ${{ steps.release_head.outputs.sha }}
run: bun .github/scripts/registry-bootstrap-ledger-state.mjs
- name: Download immutable registry bootstrap ledger
if: ${{ steps.bootstrap_ledger_state.outputs.needs_ledger == 'true' }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
node .github/scripts/download-build-artifacts.mjs \
Release \
"$RELEASE_HEAD_SHA" \
"$BOOTSTRAP_LEDGER_PATH" \
--artifact oliphaunt-bootstrap-ledger
- name: Verify immutable bootstrap ledger and registry existence
if: ${{ steps.bootstrap_ledger_state.outputs.needs_ledger == 'true' }}
env: