Skip to content

Bump version

Bump version #13

Workflow file for this run

# Manually triggered version bump.
# Pushes a tag (triggers create-release.yml) and opens a PR to merge
# the package.json version bump back into main.
name: Bump version
on:
workflow_dispatch:
inputs:
version:
description: 'Semver type of new version (major / minor / patch)'
required: true
type: choice
options:
- patch
- minor
- major
jobs:
bump-version:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install npm packages
run: npm ci
- name: Setup Git
run: |
git config user.name 'Lucian Bot'
git config user.email 'crisan.lucid@yahoo.com'
- name: Bump version
run: npm version ${{ github.event.inputs.version }}
- name: Push tag (triggers create-release workflow)
run: git push origin --tags
- name: Push version bump to a PR branch
run: |
VERSION=$(node -p "require('./package.json').version")
BRANCH="chore/bump-v${VERSION}"
git checkout -b $BRANCH
git push origin $BRANCH
- name: Open PR for version bump
run: |
VERSION=$(node -p "require('./package.json').version")
gh pr create \
--title "chore: bump version to v${VERSION}" \
--body "Automated version bump triggered by the Bump version workflow." \
--base main \
--head "chore/bump-v${VERSION}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}