Publish on NPM #8
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' | |
| jobs: | |
| publish-on-npm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Setup environment | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 16 | |
| 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 npm | |
| id: publish | |
| uses: JS-DevTools/npm-publish@v1 | |
| with: | |
| token: ${{ secrets.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 |