Publish to npm #3
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 to npm | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version to publish (e.g. 0.2.4)" | |
| required: true | |
| jobs: | |
| publish-npm: | |
| name: Publish to npm | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Set version | |
| run: | | |
| jq --arg v "${{ github.event.inputs.version }}" '.version = $v' npm/package.json > /tmp/pkg.json | |
| mv /tmp/pkg.json npm/package.json | |
| echo "Publishing npm version ${{ github.event.inputs.version }}" | |
| - name: Publish | |
| run: npm publish --access public | |
| working-directory: npm | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |