NPM publish CD workflow #57
This file contains 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: NPM publish CD workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
updateType: | |
description: 'Update type' | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
required: true | |
jobs: | |
build: | |
if: "!startsWith(github.event.head_commit.message, '[ci skip]')" | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- run: npm ci | |
- run: npm run build | |
- run: npm test | |
- run: git config --global user.name "GitHub CD bot" | |
- run: git config --global user.email "[email protected]" | |
- run: npm version ${{ github.event.inputs.updateType }} -m "[ci skip] %s" | |
- run: npm publish --provenance | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- run: git push --follow-tags | |
env: | |
github-token: ${{ secrets.GITHUB_TOKEN }} |