ci: harden npm release builds #1
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: Publish | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-node@v7 | |
| with: | |
| node-version: '22' | |
| registry-url: 'https://registry.npmjs.org' | |
| package-manager-cache: false | |
| - name: Use an npm version with trusted publishing support | |
| run: npm install --global npm@latest | |
| - run: npm ci | |
| - run: node scripts/check-release-tag.mjs | |
| env: | |
| GITHUB_REF_NAME: ${{ github.ref_name }} | |
| - run: npm run verify | |
| - name: Publish with npm provenance | |
| run: | | |
| [ -n "$NPM_TOKEN" ] && npm config set //registry.npmjs.org/:_authToken "$NPM_TOKEN" | |
| npm publish --access public --provenance | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |