Skip to content

Bump version and release #28

Bump version and release

Bump version and release #28

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@v3
with:
node-version: 14
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