Skip to content

Commit f704563

Browse files
t3dotggclaude
andcommitted
ci(release): npm publish skips the workspace checkout and install
build_bundle already has the workspace installed, so it builds the version-matched t3.tgz and hands it off as an artifact. publish_cli now checks out only the setup action and manifests, sets up the project's Node.js, checks the tarball version, and runs npm publish on it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 86d8838 commit f704563

2 files changed

Lines changed: 44 additions & 11 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,20 @@ jobs:
594594
if-no-files-found: error
595595
retention-days: 1
596596

597+
# publish_cli publishes this exact tarball, so the trusted publisher
598+
# needs no workspace checkout or install. It is version-matched here.
599+
- name: Build the npm launcher
600+
run: node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
601+
602+
# Kept past the JS bundle's one day so a rerun of a failed publish still finds it.
603+
- name: Upload the npm launcher
604+
uses: actions/upload-artifact@v7
605+
with:
606+
name: npm-launcher
607+
path: npm-packages/t3.tgz
608+
if-no-files-found: error
609+
retention-days: 7
610+
597611
# One job per platform and architecture (see release-desktop.yml), each
598612
# gated only on the JS bundle. Windows targets build on Linux and run their
599613
# native checks on a Windows runner of their own architecture.
@@ -1008,26 +1022,44 @@ jobs:
10081022
contents: read
10091023
id-token: write
10101024
steps:
1025+
# Only what setup-ci-deps reads to install the project's Node and npm.
10111026
- name: Checkout
10121027
uses: actions/checkout@v6
10131028
with:
10141029
ref: ${{ needs.preflight.outputs.ref }}
10151030
sparse-checkout: |
1016-
/*
1017-
!/.repos/
1031+
/.github/actions/setup-ci-deps/
1032+
/package.json
1033+
/pnpm-workspace.yaml
10181034
sparse-checkout-cone-mode: false
10191035

1020-
- name: Setup dependencies
1036+
- name: Setup Node.js
10211037
uses: ./.github/actions/setup-ci-deps
10221038
with:
1023-
install-args: --filter=t3... --filter=@t3tools/scripts...
1039+
install: "false"
10241040

1025-
- name: Build the npm launcher
1026-
run: node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
1041+
- name: Download the npm launcher
1042+
uses: actions/download-artifact@v8
1043+
with:
1044+
name: npm-launcher
1045+
path: npm-packages
1046+
1047+
- name: Check the npm launcher version
1048+
env:
1049+
RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
1050+
run: |
1051+
built="$(tar -xzOf npm-packages/t3.tgz package/package.json | jq -r .version)"
1052+
if [[ "$built" != "$RELEASE_VERSION" ]]; then
1053+
echo "::error::npm-launcher holds t3@$built, expected t3@$RELEASE_VERSION." >&2
1054+
exit 1
1055+
fi
10271056
10281057
- name: Publish the npm launcher
1058+
env:
1059+
DIST_TAG: ${{ needs.preflight.outputs.cli_dist_tag }}
10291060
run: |
1030-
if ! node apps/server/scripts/cli.ts publish --packages-dir npm-packages --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --provenance --verbose; then
1061+
# The ./ keeps npm from reading the path as a GitHub owner/repo spec.
1062+
if ! npm publish --access public --tag "$DIST_TAG" --provenance ./npm-packages/t3.tgz; then
10311063
echo "::error::npm publish failed. Make sure package t3 has a trusted publisher registered for .github/workflows/release.yml (see docs/operations/release.md)." >&2
10321064
exit 1
10331065
fi

‎docs/operations/release.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,10 @@ blockmaps, with a 60 MB maximum for a representative sidecar-to-sidecar update.
533533

534534
## 0) npm OIDC trusted publishing setup (CLI)
535535

536-
After the GitHub Release is published, the workflow runs `node scripts/build-npm-launcher.ts`, then
537-
`node apps/server/scripts/cli.ts publish --packages-dir npm-packages`, which runs `npm publish` on
538-
`t3.tgz`. That is the only package published per release.
536+
`build_bundle` builds the version-matched `t3.tgz` with `node scripts/build-npm-launcher.ts` and
537+
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
539+
`npm publish --provenance` on it. That is the only package published per release.
539540

540541
Checklist:
541542

@@ -663,7 +664,7 @@ Checklist:
663664
- preflight passes
664665
- release quality checks pass
665666
- `build_bundle` and all platform builds pass
666-
- `publish_cli` publishes the exact release version before the release job
667+
- `publish_cli` publishes the exact release version after the release job
667668
- release job uploads expected files
668669
5. Smoke test downloaded artifacts.
669670

0 commit comments

Comments
 (0)