Skip to content

Commit 9e17291

Browse files
committed
chore: fix npm publish
1 parent 7c52502 commit 9e17291

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@ name: Release
22

33
on:
44
workflow_dispatch:
5+
push:
6+
branches:
7+
- 09-17-chore_fix_npm_publish
58

69
jobs:
710
build-rust:
811
runs-on: ubuntu-latest
12+
needs: check-publish
913
strategy:
1014
fail-fast: false
1115
matrix:
@@ -113,7 +117,36 @@ jobs:
113117
run: |
114118
echo "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" >> ${NPM_CONFIG_USERCONFIG}
115119
echo "@voidzero-dev:registry=https://npm.pkg.github.com/" >> ${NPM_CONFIG_USERCONFIG}
120+
pnpm whoami --registry https://npm.pkg.github.com
116121
pnpm publish --filter=./packages/global --registry https://npm.pkg.github.com --no-git-checks
117122
pnpm publish --filter=./packages/cli --registry https://npm.pkg.github.com --no-git-checks
118123
env:
119124
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
125+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
127+
check-publish:
128+
runs-on: ubuntu-latest
129+
permissions:
130+
contents: read
131+
packages: write
132+
steps:
133+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
134+
135+
- uses: oxc-project/setup-node@f42e3bda950c7454575e78ee4eaac880a077700c # v1.0.0
136+
137+
- name: Setup Node.js and Authenticate
138+
uses: actions/setup-node@v4
139+
with:
140+
node-version: "22"
141+
cache: "pnpm"
142+
# This tells setup-node which registry you want to log in to
143+
registry-url: "https://npm.pkg.github.com"
144+
# If your packages are scoped (e.g., @your-org/your-package), add this
145+
scope: "@voidzero-dev"
146+
147+
- name: Verify Authentication
148+
run: pnpm whoami --registry https://npm.pkg.github.com # This should now succeed and show your GitHub username
149+
env:
150+
# This is the authentication token that setup-node uses.
151+
# GITHUB_TOKEN is automatically provided by the runner.
152+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)