GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — ci(release): npm publish no longer checks out and installs the worksp… · AndryHTC/t3code@cb8e0de

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • release.yml
  • docs/operations
    • release.md
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/release.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/release.yml
+57-8Lines changed: 57 additions & 8 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 }}
@@ -604,6 +606,22 @@ jobs:
604606
if-no-files-found: error
605607
retention-days: 1
606608

609+
# publish_cli publishes this exact tarball, so the trusted publisher
610+
# needs no workspace checkout or install. It is version-matched here.
611+
- name: Build the npm launcher
612+
run: node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
613+
614+
# GitHub allows a failed-jobs rerun for 30 days. publish_cli downloads
615+
# this upload by its ID, which a publish_cli-only rerun keeps.
616+
- name: Upload the npm launcher
617+
id: npm_launcher
618+
uses: actions/upload-artifact@v7
619+
with:
620+
name: npm-launcher
621+
path: npm-packages/t3.tgz
622+
if-no-files-found: error
623+
retention-days: 30
624+
607625
# One job per platform and architecture (see release-desktop.yml), each
608626
# gated only on the JS bundle. Windows targets build on Linux and run their
609627
# native checks on a Windows runner of their own architecture.
@@ -1023,34 +1041,65 @@ jobs:
10231041
# nothing resolves unless asked for by name.
10241042
publish_cli:
10251043
name: Publish CLI to npm
1026-
needs: [preflight, release]
1044+
needs: [preflight, build_bundle, release]
10271045
if: ${{ !failure() && !cancelled() && needs.preflight.result == 'success' && needs.release.result == 'success' }}
10281046
runs-on: ubuntu-24.04 # blacksmith-8vcpu-ubuntu-2404
10291047
timeout-minutes: 15
10301048
permissions:
10311049
contents: read
10321050
id-token: write
10331051
steps:
1052+
# Only what setup-ci-deps reads to install the project's Node and npm.
10341053
- name: Checkout
10351054
uses: actions/checkout@v6
10361055
with:
10371056
ref: ${{ needs.preflight.outputs.ref }}
10381057
sparse-checkout: |
1039-
/*
1040-
!/.repos/
1058+
/.github/actions/setup-ci-deps/
1059+
/package.json
1060+
/pnpm-workspace.yaml
10411061
sparse-checkout-cone-mode: false
10421062

1043-
- name: Setup dependencies
1063+
- name: Setup Node.js
10441064
uses: ./.github/actions/setup-ci-deps
10451065
with:
1046-
install-args: --filter=t3... --filter=@t3tools/scripts...
1066+
install: "false"
10471067

1048-
- name: Build the npm launcher
1049-
run: node scripts/build-npm-launcher.ts --version "${{ needs.preflight.outputs.version }}" --output-dir npm-packages
1068+
# Bind to build_bundle's exact upload: a name lookup takes the newest
1069+
# same-name artifact, and an empty ID downloads every artifact in the
1070+
# run. A later same-name upload hides this ID, so the download fails.
1071+
- name: Check the npm launcher artifact ID
1072+
env:
1073+
ARTIFACT_ID: ${{ needs.build_bundle.outputs.npm_launcher_artifact_id }}
1074+
run: |
1075+
if [[ ! "$ARTIFACT_ID" =~ ^[1-9][0-9]*$ ]]; then
1076+
echo "::error::build_bundle gave no valid npm-launcher artifact ID: '$ARTIFACT_ID'." >&2
1077+
exit 1
1078+
fi
1079+
1080+
- name: Download the npm launcher
1081+
uses: actions/download-artifact@v8
1082+
with:
1083+
artifact-ids: ${{ needs.build_bundle.outputs.npm_launcher_artifact_id }}
1084+
path: npm-packages
1085+
digest-mismatch: error
1086+
1087+
- name: Check the npm launcher version
1088+
env:
1089+
RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
1090+
run: |
1091+
built="$(tar -xzOf npm-packages/t3.tgz package/package.json | jq -r .version)"
1092+
if [[ "$built" != "$RELEASE_VERSION" ]]; then
1093+
echo "::error::npm-launcher holds t3@$built, expected t3@$RELEASE_VERSION." >&2
1094+
exit 1
1095+
fi
10501096
10511097
- name: Publish the npm launcher
1098+
env:
1099+
DIST_TAG: ${{ needs.preflight.outputs.cli_dist_tag }}
10521100
run: |
1053-
if ! node apps/server/scripts/cli.ts publish --packages-dir npm-packages --tag "${{ needs.preflight.outputs.cli_dist_tag }}" --provenance --verbose; then
1101+
# The ./ keeps npm from reading the path as a GitHub owner/repo spec.
1102+
if ! npm publish --access public --tag "$DIST_TAG" --provenance ./npm-packages/t3.tgz; then
10541103
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
10551104
exit 1
10561105
fi
Collapse file

‎docs/operations/release.md‎

Copy file name to clipboardExpand all lines: docs/operations/release.md
+6-4Lines changed: 6 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -533,9 +533,11 @@ 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, downloads that exact upload by the
539+
artifact ID `build_bundle` outputs (never by name), checks the tarball version, and runs
540+
`npm publish --provenance` on it. That is the only package published per release.
539541

540542
Checklist:
541543

@@ -663,7 +665,7 @@ Checklist:
663665
- preflight passes
664666
- release quality checks pass
665667
- `build_bundle` and all platform builds pass
666-
- `publish_cli` publishes the exact release version before the release job
668+
- `publish_cli` publishes the exact release version after the release job
667669
- release job uploads expected files
668670
5. Smoke test downloaded artifacts.
669671

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.