Update package version #11
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: Update package version | |
on: | |
workflow_dispatch: | |
inputs: | |
version-increment-type: | |
description: "What would you like to increment? Major, minor or patch?" | |
required: true | |
default: "patch" | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
increment-version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js 22 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 22.14.0 | |
cache: "yarn" | |
- name: Increment package version | |
run: | | |
git log | |
git config user.name 'GHA Workflow' | |
git config user.email '-' | |
NEW_VERSION=`npm version ${{ github.event.inputs.version-increment-type }} -m "Upgrading package version to %s"` | |
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV # Save to environment | |
git log | |
git checkout -b package-version-update | |
git push --follow-tags --force origin package-version-update | |
- name: Create Pull Request | |
run: | | |
gh pr create --base main --head package-version-update --title "Update package version to $NEW_VERSION" --body "This PR was created automatically." | |
env: | |
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} |