ci: fix npm authentication by using setup-node's NODE_AUTH_TOKEN #17
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # see https://help.github.com/cn/actions/language-and-framework-guides/publishing-nodejs-packages | |
| name: Release Packages | |
| on: | |
| workflow_dispatch: {} | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| publish: | |
| name: 'Publish to npm' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Enable Corepack (PNPM from packageManager) | |
| run: | | |
| corepack enable | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| registry-url: 'https://registry.npmjs.org' | |
| cache: 'pnpm' | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| env: | |
| HUSKY: 0 | |
| - name: Build | |
| run: pnpm -w build | |
| - name: Verify npm authentication | |
| run: npm whoami | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish with Changesets | |
| run: pnpm release | |
| env: | |
| NPM_CONFIG_PROVENANCE: true | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |