Skip to content

Use PAT for version bump push to bypass branch protection (#150) #2

Use PAT for version bump push to bypass branch protection (#150)

Use PAT for version bump push to bypass branch protection (#150) #2

Workflow file for this run

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
token: ${{ secrets.NOTE_PYTHON_PUSH }}
- 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