Fix and simplify release workflow. #34
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: Release NPM package | |
| on: | |
| push: | |
| tags: ['v*'] | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| name: Node build | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-${{ matrix.node }}-npm-${{ hashFiles('**/package-lock.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-npm- | |
| - name: Setup node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| # Ensure npm 11.5.1 or later is installed | |
| - run: npm install -g npm@latest | |
| - run: npm ci | |
| - run: npm run build | |
| - run: npm test | |
| release: | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| name: Release | |
| steps: | |
| - name: Set tag | |
| id: tagName | |
| run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
| - name: Publish package | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| run: npm publish |