Skip to content

Commit eef84e3

Browse files
authored
Merge pull request #3 from BunsDev/okcode/npm-publish-auth-fix
Add npm token validation to release workflow
2 parents e143f1b + fdeddea commit eef84e3

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,16 @@ jobs:
4040
- name: Build packages
4141
run: pnpm run build
4242

43+
- name: Ensure NPM token is present
44+
run: |
45+
test -n "${NPM_TOKEN}" || { echo "::error::NPM_TOKEN secret is missing or empty"; exit 1; }
46+
env:
47+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
48+
4349
- name: Authenticate to npm
4450
run: |
45-
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
51+
npm config set //registry.npmjs.org/:_authToken "${NPM_TOKEN}"
52+
npm config set @create-markdown:registry https://registry.npmjs.org/
4653
env:
4754
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4855

@@ -57,3 +64,4 @@ jobs:
5764
env:
5865
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5966
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
67+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)