Skip to content

Update Version

Update Version #3

# .github/workflows/update-version.yml
name: Update Version
on:
workflow_dispatch:
inputs:
version_type:
description: 'Version type to increment'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
jobs:
update-version:
runs-on: ubuntu-latest
permissions:
contents: write
packages: read
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://npm.pkg.github.com'
scope: '@tobenot'
- name: Install dependencies
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update version
run: REGISTRY_URL=https://npm.pkg.github.com NODE_AUTH_TOKEN=${{ secrets.GITHUB_TOKEN }} npm run version:${{ github.event.inputs.version_type }}
- name: Commit and push version update
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add package.json package-lock.json || true
if git diff --cached --quiet; then
echo "No changes to commit"
else
git commit -m "chore: version bump (${{ github.event.inputs.version_type }})"
git push
fi