This repository has been archived by the owner on Nov 10, 2024. It is now read-only.
Create Release Pull Request #5
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 Pull Request | |
on: | |
workflow_dispatch: | |
inputs: | |
base-branch: | |
description: 'The base branch for git operations and the pull request.' | |
default: 'main' | |
required: true | |
release-version: | |
description: 'A specific version to bump to, i.e. 0.1.1' | |
required: true | |
jobs: | |
create-release-pr: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
# This is to guarantee that the most recent tag is fetched. | |
# This can be configured to a more reasonable value by consumers. | |
fetch-depth: 0 | |
# We check out the specified branch, which will be used as the base | |
# branch for all git operations and the release PR. | |
ref: ${{ github.event.inputs.base-branch }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 14 | |
- name: Create release branch | |
run: | | |
branch_name="release/v${{ github.event.inputs.release-version }}" | |
git checkout -b $branch_name | |
git push origin $branch_name | |
echo "::set-output name=branch_name::$branch_name" | |
- name: Open Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ steps.create-release-pr.outputs.branch_name }} | |
title: "Release v${{ github.event.inputs.release-version }}" | |
body: "Automated release PR for version v${{ github.event.inputs.release-version }}" |