Release #13
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
# 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://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
name: Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Release type | |
required: false | |
type: choice | |
default: patch | |
options: | |
- patch | |
- minor | |
- major | |
release: | |
types: [created] | |
jobs: | |
build: | |
uses: ./.github/workflows/build.yml | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
name: Update version in package.json | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository. | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Bump version | |
id: version | |
uses: KageKirin/[email protected] | |
with: | |
major: ${{ github.event.inputs.version == 'major' }} | |
minor: ${{ github.event.inputs.version == 'minor' }} | |
patch: ${{ github.event.inputs.version == 'patch' }} | |
- name: Commit & tag version | |
uses: EndBug/add-and-commit@v9 | |
with: | |
author_name: cheese_grinder_ci | |
author_email: [email protected] | |
committer_name: cheese_grinder_ci | |
committer_email: [email protected] | |
message: "ci(version): bump to ${{ steps.version.outputs.version }}" | |
tag: "v${{ steps.version.outputs.version }}" | |
- name: npm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- run: npm ci | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |