Skip to content

Commit 2bc24cd

Browse files
authored
fix(release): align npm auth variables (#188)
1 parent ceaa183 commit 2bc24cd

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
- name: Authenticate classic package token
6666
env:
6767
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}
68+
GITHUB_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}
6869
run: npm whoami --registry=https://npm.pkg.github.com
6970

7071
build-native-artifacts:
@@ -747,6 +748,7 @@ jobs:
747748
- name: Publish only certified tarballs
748749
env:
749750
NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}
751+
GITHUB_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}
750752
shell: bash
751753
run: |
752754
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 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.
102+
The workflow exposes the `PACKAGE_PUBLISH_TOKEN` Actions secret as both `NODE_AUTH_TOKEN` for `actions/setup-node` and `GITHUB_TOKEN` for the repository `.npmrc` in 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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ describe("certified release workflows", () => {
2626

2727
expect(authPreflight).toContain("npm whoami --registry=https://npm.pkg.github.com");
2828
expect(authPreflight).toContain("NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}");
29+
expect(authPreflight).toContain("GITHUB_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}");
2930
expect(buildNative).toContain("- registry-auth-preflight");
3031
expect(assemble).toContain("- build-native-artifacts");
3132
expect(security).toContain("- assemble-release-candidates");
@@ -62,6 +63,7 @@ describe("certified release workflows", () => {
6263
expect(releaseWorkflow).not.toContain("npm pack");
6364
expect(publish).toContain("publish-release-candidates.mjs");
6465
expect(publish).toContain("NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}");
66+
expect(publish).toContain("GITHUB_TOKEN: ${{ secrets.PACKAGE_PUBLISH_TOKEN }}");
6567
expect(publish).not.toContain("CODEGRAPH_PACKAGES_TOKEN_B64");
6668
expect(publish).not.toContain("base64 --decode");
6769
expect(publish).toContain("temp/release-candidates/packages/*.tgz");

0 commit comments

Comments
 (0)