Publish on NPM #12
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
| # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages | |
| name: Publish on NPM | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version-increment: | |
| type: choice | |
| description: 'Version Increment' | |
| required: true | |
| options: | |
| - 'patch' | |
| - 'minor' | |
| - 'major' | |
| default: 'patch' | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: read | |
| jobs: | |
| publish-on-npm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup environment | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Versionate | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "GitHub Action" | |
| npm version ${{ github.event.inputs.version-increment }} | |
| - name: Build | |
| run: npm ci | |
| - name: Publish to NPM | |
| # This command uses the GitHub OIDC token automatically | |
| run: npm publish | |
| - name: Create PR | |
| uses: peter-evans/[email protected] | |
| with: | |
| commit-message: Updated repository to ${{ steps.publish.outputs.version }} | |
| title: Bump version to ${{ steps.publish.outputs.version }} | |
| body: New release build | |
| branch: release/${{ steps.publish.outputs.version }} | |
| base: master |