Add auto version bump workflow on tagged releases (#149) #1
Workflow file for this run
This file contains hidden or 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: Update Version | |
| on: | |
| push: | |
| tags: | |
| - v* | |
| jobs: | |
| update-version: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| - name: Extract version from tag | |
| run: echo "TAG_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
| - name: Update pyproject.toml version | |
| run: sed -i "s/^version = \".*\"/version = \"$TAG_VERSION\"/" pyproject.toml | |
| - name: Commit and push version update | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git diff --exit-code pyproject.toml && echo "Version already up to date" && exit 0 | |
| git add pyproject.toml | |
| git commit -m "Bump version to $TAG_VERSION" | |
| git push origin main |