Skip to content

FragileTech/bump-version

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

bump2version-action

GitHub Action to increment the project's version using bump2version, commit, tag, and push the change. This operation can be fine-tuned in .bumpversion.cfg, see bumpversion --help for the details.

How to use

You need to obtain a Personal Access Token to push to your repository and save it in your Secrets as BOT_TOKEN. Suppose that your GitHub account is @your-bot-login "Your Company Bot" <bot@your-company.com>. Suppose that your version lies in file version.md like this:

# version 1.0.0

Create a new workflow (or append to an existing one) .github/workflows/bump-version.yml:

name: Bump version workflow

on:
  push:
    branches:
    - main

jobs:
  bump-version:
    name: Bump package version
    if: "!contains(github.event.head_commit.message, 'Bump version')"
    runs-on: ubuntu-20.04
    steps:
    - name: actions/checkout
      uses: actions/checkout@v2
      with:
          persist-credentials: false
    - name: current_version
      run: echo "current_version=$(grep '# version' version.md | cut -d ' ' -f3)" >> $GITHUB_ENV
    - name: FragileTech/bump-version
      uses: FragileTech/bump-version@main
      with:
        current_version: "${{ env.current_version }}"
        files: version.md
        commit_name: Your Company Bot
        commit_email: bot@your-company.com
        login: your-bot-login
        token: "${{ secrets.BOT_TOKEN }}"

Now every time you merge something to main branch, you'll receive an additional direct commit to main that increments the version in version.md.

License

MIT, see LICENSE.

About

GitHub Action to bump the version of a Python package.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •