initial commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
name: Sync pyproject.toml Version
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Publish Python Package"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
commit-version-update:
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.workflow_run.head_branch }}
|
||||
token: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: ${{ vars.PYTHON_VERSION }}
|
||||
|
||||
- name: Configure git
|
||||
run: |
|
||||
git config user.name "CI Bot"
|
||||
git config user.email "[email protected]"
|
||||
|
||||
- name: Update version in pyproject.toml to match tag
|
||||
run: |
|
||||
TAG_VERSION="${{ github.event.workflow_run.head_branch }}"
|
||||
VERSION="${TAG_VERSION#v}"
|
||||
sed -i.bak -E "s/^version = \".*\"/version = \"${VERSION}\"/" pyproject.toml
|
||||
rm pyproject.toml.bak
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git add pyproject.toml
|
||||
git commit -m "chore: update version in pyproject.toml to ${VERSION} [skip ci]" || echo "No changes to commit"
|
||||
git push
|
||||
Reference in New Issue
Block a user