Bump version and release #39
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: Bump version and release | |
on: | |
workflow_dispatch: | |
inputs: | |
bump-type: | |
type: choice | |
description: Bump type | |
default: patch | |
options: | |
- patch | |
- minor | |
- major | |
required: true | |
jobs: | |
bump-and-release: | |
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: Bump version | |
id: bump | |
env: | |
GH_ACTIONS_BOT_NAME: github-actions[bot] | |
GH_ACTIONS_BOT_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
run: | | |
git config --local user.name $GH_ACTIONS_BOT_NAME | |
git config --local user.email $GH_ACTIONS_BOT_EMAIL | |
new_version_tag=$(npm version ${{ github.event.inputs.bump-type }}) | |
git push origin master | |
git push origin $new_version_tag | |
echo "tag=$new_version_tag" >> $GITHUB_OUTPUT | |
- name: Release | |
uses: octokit/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
route: POST /repos/{owner}/{repo}/releases | |
owner: ${{ github.repository_owner }} | |
repo: ${{ github.event.repository.name }} | |
tag_name: ${{ steps.bump.outputs.tag }} | |
generate_release_notes: true | |
- name: Publish to npm public registry | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: npm publish |