ci: migrate npm publish authentication to OIDC and configure Node.js environment for publishing.

This commit is contained in:
CodingInCarhartts
2025-12-14 19:01:34 -08:00
parent c6c808afd7
commit 782be1fa3d
+13 -6
View File
@@ -7,6 +7,10 @@ on:
- "src/**"
- "package.json"
permissions:
id-token: write # ← Required for OIDC
contents: read
jobs:
publish:
runs-on: ubuntu-latest
@@ -17,16 +21,19 @@ jobs:
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
- name: Ensure latest npm
run: npm install -g npm@latest
- name: Install dependencies
run: bun install
- name: Build
run: bun run build
- name: Setup npm auth
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public