Version bump #80
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: Version bump | |
on: | |
workflow_dispatch: | |
inputs: | |
dry_run: | |
description: "Run the action without creating a PR or release draft" | |
required: true | |
type: boolean | |
bump: | |
description: "Version bump type" | |
required: true | |
type: choice | |
default: auto | |
options: | |
- auto | |
- patch | |
- minor | |
- major | |
prerelease: | |
description: "Increase to this prerelease version" | |
required: false | |
type: choice | |
default: none | |
options: | |
- none | |
- alpha | |
- beta | |
- rc | |
jobs: | |
create_release_branch_pr: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
permissions: | |
contents: write # to create a github release | |
pull-requests: write # to create and update PRs | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5.0.0 | |
with: | |
python-version: "3.10" | |
architecture: x64 | |
- name: Bump version | |
id: cz-bump | |
uses: commitizen-tools/commitizen-action@0.21.0 | |
with: | |
increment: ${{ github.event.inputs.bump != 'auto' && github.event.inputs.bump || '' }} | |
prerelease: ${{ github.event.inputs.prerelease != 'none' && github.event.inputs.prerelease || '' }} | |
commit: "false" | |
push: "false" | |
changelog: ${{ github.event.inputs.prerelease == 'none' && 'true' || 'false' }} | |
github_token: ${{ secrets.MELTYBOT_GITHUB_AUTH_TOKEN }} | |
extra_requirements: 'git+https://github.com/meltano/commitizen-version-bump@main' | |
changelog_increment_filename: ${{ github.event.inputs.prerelease == 'none' && '_changelog_fragment.md' || '' }} | |
- name: Add job summary | |
run: | | |
cat _changelog_fragment.md >> $GITHUB_STEP_SUMMARY | |
- name: Draft Release | |
if: ${{ github.event.inputs.dry_run == 'false' }} | |
id: draft-release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
body_path: ${{ github.event.inputs.prerelease == 'none' && '_changelog_fragment.md' || '' }} | |
tag_name: v${{ steps.cz-bump.outputs.version }} | |
prerelease: ${{ github.event.inputs.prerelease != 'none' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Pull Request | |
if: ${{ github.event.inputs.dry_run == 'false' }} | |
uses: peter-evans/create-pull-request@v6 | |
id: create-pull-request | |
with: | |
# https://github.com/peter-evans/create-pull-request | |
token: ${{ secrets.MELTYBOT_GITHUB_AUTH_TOKEN }} | |
commit-message: "chore: Bump package version" | |
title: "chore: Release v${{ steps.cz-bump.outputs.version }}" | |
body: | | |
Bump changelog for release v${{ steps.cz-bump.outputs.version }} | |
branch: release/v${{ steps.cz-bump.outputs.version }} | |
base: main | |
labels: release |