Skip to content

Bump version and changelog #522

Bump version and changelog

Bump version and changelog #522

Workflow file for this run

name: Bump version and changelog
on:
workflow_dispatch:
inputs:
version:
description: 'The version to release (e.g 1.2.3)'
required: true
default: ''
type: string
jobs:
bumpversion:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ github.event.inputs.version }}
previous_tag: ${{ steps.tag_version.outputs.previous_tag }}
bump_commit_sha: ${{ steps.bumpversion.outputs.commit_hash }}
pr_number: ${{ steps.cpr.outputs.pull-request-number }}
steps:
- uses: actions/checkout@v4
- name: Get next version
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: ${{ github.event.inputs.version }}
default_prerelease_bump: false
dry_run: true
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Create bumpversion
if: github.event.inputs.version
run: |
pip install bump2version
bump2version --new-version ${{ github.event.inputs.version }} setup.cfg tutoraspects/__about__.py .ci/config.yml
- name: Update Changelog
if: github.event.inputs.version
uses: stefanzweifel/[email protected]
with:
latest-version: v${{ github.event.inputs.version }}
release-notes: ${{ steps.tag_version.outputs.changelog }}
- name: Push branch
if: github.event.inputs.version
run: |
branch_name="bot/v${{ github.event.inputs.version }}"
git fetch --prune origin
if git show-ref --quiet refs/remotes/origin/$branch_name; then
git push --delete origin $branch_name
fi
git checkout -b $branch_name || git checkout $branch_name
git push origin $branch_name
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
title: "chore: preparing release ${{ github.event.inputs.version }}"
commit-message: "chore: preparing release ${{ github.event.inputs.version }}"
branch: "bot/v${{github.event.inputs.version}}"
base: main
body: |
Automated version bump for release ${{ github.event.inputs.version }}.
This pull request was automatically generated. It includes the following changes:
- Version: v${{ github.event.inputs.version }}
- Previous version: ${{ steps.tag_version.outputs.previous_tag }}
${{ steps.tag_version.outputs.changelog }}
No code changes are included in this pull request. The purpose of this PR is to trigger a version bump for the project.
Once the pull request is merged, a new GitHub release will be created with the updated version.