Fix npm publish auth (#14) #11
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
| name: CI | |
| on: | |
| push: | |
| branches: main | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: "**" | |
| jobs: | |
| all: | |
| name: all | |
| runs-on: ubuntu-latest | |
| permissions: | |
| # https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4.4.0 | |
| with: | |
| # Needed for NODE_AUTH_TOKEN env var to work for npm publish | |
| # https://github.com/actions/setup-node#:~:text=NODE_AUTH_TOKEN.%0A%20%20%20%20%23%20Default%3A%20%27%27-,registry,-%2Durl%3A%20%27 | |
| registry-url: https://registry.npmjs.org | |
| - run: npm install | |
| - run: npm run build | |
| - name: Publish to NPM | |
| if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
| run: npm publish --provenance --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |