Skip to content

Commit 99278b3

Browse files
t3dotggclaude
andcommitted
ci(release): npm publish downloads build_bundle's exact artifact by ID
A name lookup takes the newest same-name artifact, so a replaced same-version tarball passed the version check. build_bundle now outputs the upload's artifact ID and publish_cli downloads only that ID. An empty or malformed ID fails before download-artifact can fall back to downloading every artifact in the run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 030c7d2 commit 99278b3

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,8 @@ jobs:
517517
if: ${{ !cancelled() && needs.preflight.result == 'success' && needs.relay_public_config.result == 'success' }}
518518
runs-on: blacksmith-32vcpu-ubuntu-2404
519519
timeout-minutes: 30
520+
outputs:
521+
npm_launcher_artifact_id: ${{ steps.npm_launcher.outputs.artifact-id }}
520522
env:
521523
T3CODE_CLERK_PUBLISHABLE_KEY: ${{ needs.relay_public_config.outputs.clerk_publishable_key }}
522524
T3CODE_CLERK_JWT_TEMPLATE: ${{ needs.relay_public_config.outputs.clerk_jwt_template }}
@@ -599,9 +601,10 @@ jobs:
599601
- name: Build the npm launcher
600602
run: node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
601603

602-
# GitHub allows a failed-jobs rerun for 30 days, and a publish_cli rerun
603-
# reads this artifact from the original attempt.
604+
# GitHub allows a failed-jobs rerun for 30 days. publish_cli downloads
605+
# this upload by its ID, which a publish_cli-only rerun keeps.
604606
- name: Upload the npm launcher
607+
id: npm_launcher
605608
uses: actions/upload-artifact@v7
606609
with:
607610
name: npm-launcher
@@ -1015,7 +1018,7 @@ jobs:
10151018
# nothing resolves unless asked for by name.
10161019
publish_cli:
10171020
name: Publish CLI to npm
1018-
needs: [preflight, release]
1021+
needs: [preflight, build_bundle, release]
10191022
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' }}
10201023
runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
10211024
timeout-minutes: 15
@@ -1039,11 +1042,24 @@ jobs:
10391042
with:
10401043
install: "false"
10411044

1045+
# Bind to build_bundle's exact upload: a name lookup takes the newest
1046+
# same-name artifact, and an empty ID downloads every artifact in the
1047+
# run. A later same-name upload hides this ID, so the download fails.
1048+
- name: Check the npm launcher artifact ID
1049+
env:
1050+
ARTIFACT_ID: ${{ needs.build_bundle.outputs.npm_launcher_artifact_id }}
1051+
run: |
1052+
if [[ ! "$ARTIFACT_ID" =~ ^[1-9][0-9]*$ ]]; then
1053+
echo "::error::build_bundle gave no valid npm-launcher artifact ID: '$ARTIFACT_ID'." >&2
1054+
exit 1
1055+
fi
1056+
10421057
- name: Download the npm launcher
10431058
uses: actions/download-artifact@v8
10441059
with:
1045-
name: npm-launcher
1060+
artifact-ids: ${{ needs.build_bundle.outputs.npm_launcher_artifact_id }}
10461061
path: npm-packages
1062+
digest-mismatch: error
10471063

10481064
- name: Check the npm launcher version
10491065
env:

‎docs/operations/release.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,8 @@ blockmaps, with a 60 MB maximum for a representative sidecar-to-sidecar update.
535535

536536
`build_bundle` builds the version-matched `t3.tgz` with `node scripts/build-npm-launcher.ts` and
537537
uploads it as the `npm-launcher` artifact. After the GitHub Release is published, `publish_cli`
538-
checks out only what it needs to set up the project's Node.js, checks the tarball version, and runs
538+
checks out only what it needs to set up the project's Node.js, downloads that exact upload by the
539+
artifact ID `build_bundle` outputs (never by name), checks the tarball version, and runs
539540
`npm publish --provenance` on it. That is the only package published per release.
540541

541542
Checklist:

0 commit comments

Comments
 (0)