Release: Create Pull Request #63
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: 'Release: Create Pull Request' | |
on: | |
workflow_dispatch: | |
inputs: | |
base-branch: | |
description: 'The branch, tag, or commit to create this release PR from.' | |
required: true | |
default: 'master' | |
release-type: | |
description: 'A SemVer release type.' | |
required: true | |
type: choice | |
default: 'minor' | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
create-release-pr: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
timeout-minutes: 5 | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.base-branch }} | |
- run: corepack enable | |
- uses: actions/[email protected] | |
with: | |
node-version: 20.x | |
- run: npm install --prefix=.github/scripts --no-package-lock | |
- name: Bump package versions | |
run: | | |
echo "NEXT_RELEASE=$(node .github/scripts/bump-versions.mjs)" >> $GITHUB_ENV | |
env: | |
RELEASE_TYPE: ${{ github.event.inputs.release-type }} | |
- name: Push the base branch | |
run: | | |
git push -f origin refs/remotes/origin/${{ github.event.inputs.base-branch }}:refs/heads/release/${{ env.NEXT_RELEASE }} | |
- name: Push the release branch, and Create the PR | |
uses: peter-evans/create-pull-request@v6 | |
id: create-pull-request | |
with: | |
base: 'release/${{ env.NEXT_RELEASE }}' | |
branch: 'release-pr/${{ env.NEXT_RELEASE }}' | |
commit-message: 'Bump package versions' | |
delete-branch: true | |
labels: release,release:${{ github.event.inputs.release-type }} | |
title: ':rocket: Release ${{ env.NEXT_RELEASE }}' | |
body: '' | |
- run: | | |
git checkout release-pr/${{ env.NEXT_RELEASE }} | |
- name: Generate Changelog | |
run: node .github/scripts/update-changelog.mjs | |
- run: echo "${{ env.NEXT_RELEASE }}" | |
- run: ls -al | |
- name: Update PR | |
run: | | |
gh pr edit ${{ steps.create-pull-request.outputs.pull-request-number }} --body-file 'CHANGELOG-${{ env.NEXT_RELEASE }}.md' | |
git config user.name "github-actions[bot]" | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git commit CHANGELOG.md -m "Changelog for ${{ env.NEXT_RELEASE }}" | |
git push origin release-pr/${{ env.NEXT_RELEASE }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |