Skip to content

chore: correct bump version workflow #104

chore: correct bump version workflow

chore: correct bump version workflow #104

Workflow file for this run

name: Bump version and changelog
on:
push:
branches:
- main
pull_request:
jobs:
bumpversion:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.tag_version.outputs.new_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@v3
- name: Get next version
id: tag_version
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
default_bump: false
default_prerelease_bump: false
dry_run: true
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Create bumpversion
if: steps.tag_version.outputs.new_version
run: |
pip install bump2version
bump2version --new-version ${{ steps.tag_version.outputs.new_version }} setup.cfg tutoraspects/__about__.py
- name: Update Changelog
if: steps.tag_version.outputs.new_version
uses: stefanzweifel/changelog-updater-action@v1.9.0
with:
latest-version: ${{ steps.tag_version.outputs.new_tag }}
release-notes: ${{ steps.tag_version.outputs.changelog }}
- name: Push branch
if: steps.tag_version.outputs.new_version
run: |
branch_name="bot/v${{ steps.tag_version.outputs.new_version }}"
git fetch --prune origin
git checkout -b $branch_name || git checkout $branch_name
git push --delete origin $branch_name # Delete the branch if it already exists
git push origin $branch_name
- name: Create Pull Request
if: steps.tag_version.outputs.new_version
id: cpr
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.SEMANTIC_RELEASE_GITHUB_TOKEN }}
title: "chore: preparing release ${{ steps.tag_version.outputs.new_version }}"
commit-message: "chore: preparing release ${{ steps.tag_version.outputs.new_version }}"
branch: "bot/v${{steps.tag_version.outputs.new_version}}"
base: main
body: |
Automated version bump for release ${{ steps.tag_version.outputs.new_version }}.
This pull request was automatically generated. It includes the following changes:
- Version: ${{ steps.tag_version.outputs.new_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.