Update version and create Release's PR Workflow #4
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's PR Workflow | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version name' | |
required: true | |
type: string | |
pattern: '^[0-9]+\.[0-9]+\.[0-9]+$' | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | |
permissions: | |
contents: write | |
pull-requests: write | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Setup Git | |
run: | | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
- name: Update the version | |
id: update_version | |
run: | | |
echo "__version__ = '${{ inputs.version }}'" > pt_cli/__version__.py | |
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT | |
- name: Update Changelog | |
run: | | |
npm install -g auto-changelog | |
auto-changelog -v ${{ steps.update_version.outputs.version }} | |
- 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: Candidate Version ${{ steps.update_version.outputs.version }} Pull Request" | |
body: "This pull request contains the updated __version__.py file with the new release version" | |
base: main |