Create release PR #19
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: Create release PR | |
permissions: | |
contents: read | |
on: | |
workflow_dispatch: | |
inputs: | |
major_branch: | |
description: Major version branch | |
type: choice | |
default: main | |
options: | |
- main | |
- v5.x | |
release_type: | |
description: Type of release | |
type: choice | |
default: patch | |
options: | |
- patch | |
- minor | |
jobs: | |
create-pr: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ inputs.major_branch }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Git Config | |
run: | | |
git config --global user.email "github-actions@github.com" | |
git config --global user.name "github-actions" | |
- name: Change version number and push | |
id: bump | |
run: | | |
npm version ${{ inputs.release_type }} --git-tag-version=false | |
VERSION=`jq -r ".version" package.json` | |
RELEASE_BRANCH="release/v$VERSION" | |
git add -u | |
git commit -m "Bumped v$VERSION" | |
git push origin "HEAD:$RELEASE_BRANCH" | |
echo "version=$VERSION" >> $GITHUB_OUTPUT | |
- name: Create PR | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const versionTag = "v${{ steps.bump.outputs.version }}" | |
await require('./scripts/release').generatePr({ github, context, versionTag }) |