Update version and create Release PR Workflow #3
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 version and create Release PR Workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version name' | |
required: true | |
default: 'minor' | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
concurrency: | |
group: 'pages' | |
cancel-in-progress: false | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '22' | |
cache: npm | |
- name: Install dependencies | |
run: npm ci | |
- name: Set up Git | |
run: | | |
git config user.name "kelseymorsebrown" | |
git config user.email "[email protected]" | |
- name: Update the version | |
id: update_version | |
run: | | |
echo "version=$(npm version ${{ github.event.inputs.version }} --no-git-tag-version)" >> $GITHUB_OUTPUT | |
- name: Update Changelog | |
id: update_changelog | |
run: | | |
sed -i 's/Unreleased/${{ steps.update_version.outputs.version }}/g' CHANGELOG.md | |
- name: Create pull request | |
id: create_pr | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: release/${{ steps.update_version.outputs.version }} | |
title: 'Release: ${{ steps.update_version.outputs.version }} Pull Request' | |
body: 'This pull request contains the updated package.json with the new release version' | |
base: main |