Release Prep #12
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 Prep" | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "The version number for the next release." | |
required: true | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
target: | |
description: "The target for the release. This can be a commit sha or a branch." | |
required: false | |
default: "main" | |
type: "string" | |
jobs: | |
release_prep: | |
name: "release prep" | |
runs-on: "ubuntu-latest" | |
steps: | |
- name: "checkout" | |
uses: "actions/checkout@v3" | |
with: | |
ref: ${{ github.event.inputs.target }} | |
clean: true | |
fetch-depth: 0 | |
- name: "set up python" | |
uses: "actions/setup-python@v2" | |
with: | |
python-version: '3.10' | |
- name: "install poetry" | |
uses: "snok/install-poetry@v1" | |
with: | |
virtualenvs-in-project: true | |
- name: "install dependencies" | |
run: | | |
poetry install | |
- name: "bump version" | |
id: "bump_version" | |
run: | | |
next_version=$(poetry version ${{ github.event.inputs.version }} -s) | |
echo "version=$next_version" >> $GITHUB_OUTPUT | |
- name: "generate changelog" | |
run: | | |
export GH_HOST=github.com | |
gh extension install chelnak/gh-changelog | |
gh changelog new --next-version v${{ steps.bump_version.outputs.version }} | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "commit changes" | |
run: | | |
git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com" | |
git config --local user.name "GitHub Actions" | |
git add . | |
git commit -m "Release prep v${{ steps.bump_version.outputs.version }}" | |
- name: "create pull request" | |
uses: "peter-evans/create-pull-request@v4" | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
commit-message: "Release prep v${{ steps.bump_version.outputs.version }}" | |
branch: "release-prep" | |
delete-branch: true | |
title: "Release prep v${{ steps.bump_version.outputs.version }}" | |
base: "main" | |
body: | | |
Automated release-prep from commit ${{ github.sha }}. | |
labels: "maintenance" |