Skip to content

Commit ceaa183

Browse files
authored
fix(release): require classic package token (#187)
1 parent 75f63bb commit ceaa183

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
echo "$version" >> "$GITHUB_OUTPUT"
5252
5353
registry-auth-preflight:
54-
name: Verify GitHub Packages authentication
54+
name: Verify classic package token
5555
needs: plan-release
5656
runs-on: ubuntu-latest
5757
steps:
@@ -62,9 +62,9 @@ jobs:
6262
registry-url: https://npm.pkg.github.com
6363
scope: "@lzehrung"
6464

65-
- name: Authenticate with the workflow token
65+
- name: Authenticate classic package token
6666
env:
67-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}
6868
run: npm whoami --registry=https://npm.pkg.github.com
6969

7070
build-native-artifacts:
@@ -746,7 +746,7 @@ jobs:
746746
747747
- name: Publish only certified tarballs
748748
env:
749-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
749+
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}
750750
shell: bash
751751
run: |
752752
node ./scripts/certification/publish-release-candidates.mjs \

PUBLISHING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ A structural result proves archive checksum, package identity, target naming, an
9999

100100
Publishing waits for every required package row plus security, semantics, and hermeticity. Missing, failed, stale-revision, wrong-version, expired-exception, size, or checksum evidence stops the job before `npm publish` is invoked.
101101

102-
The workflow uses its repository-scoped `GITHUB_TOKEN` with `packages: write`; it does not prefer long-lived package secrets. A registry authentication preflight runs before native builds so invalid workflow access fails before the certification matrix starts.
102+
The workflow uses the `PACKAGE_PUBLISH_TOKEN` Actions secret in both the registry preflight and publication job. It must contain a current classic personal access token with `read:packages` and `write:packages`; GitHub Packages does not support fine-grained personal access tokens for this purpose.
103103

104104
## Package Roles
105105

tests/certification-release-workflow.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe("certified release workflows", () => {
2525
const publish = jobBlock(releaseWorkflow, "publish-certified");
2626

2727
expect(authPreflight).toContain("npm whoami --registry=https://npm.pkg.github.com");
28-
expect(authPreflight).toContain("NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}");
28+
expect(authPreflight).toContain("NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}");
2929
expect(buildNative).toContain("- registry-auth-preflight");
3030
expect(assemble).toContain("- build-native-artifacts");
3131
expect(security).toContain("- assemble-release-candidates");
@@ -61,8 +61,7 @@ describe("certified release workflows", () => {
6161
expect(releaseWorkflow.split("assemble-release-candidates.mjs")).toHaveLength(2);
6262
expect(releaseWorkflow).not.toContain("npm pack");
6363
expect(publish).toContain("publish-release-candidates.mjs");
64-
expect(publish).toContain("NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}");
65-
expect(publish).not.toContain("PACKAGE_PUBLISH_TOKEN");
64+
expect(publish).toContain("NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}");
6665
expect(publish).not.toContain("CODEGRAPH_PACKAGES_TOKEN_B64");
6766
expect(publish).not.toContain("base64 --decode");
6867
expect(publish).toContain("temp/release-candidates/packages/*.tgz");

0 commit comments

Comments
 (0)