@@ -18,22 +18,56 @@ jobs:
1818 with :
1919 fetch-depth : 0
2020
21+ - name : Set up Python
22+ uses : actions/setup-python@v5
23+ with :
24+ python-version : " 3.*"
25+
26+ - name : Install uv
27+ uses : astral-sh/setup-uv@v4
28+ with :
29+ version : " latest"
30+
31+ - name : Determine version bump
32+ id : detect-bump
33+ run : |
34+ # Check PR labels to determine bump type
35+ LABELS="${{ github.event.pull_request.labels.*.name }}"
36+ if echo "$LABELS" | grep -q "Major"; then
37+ echo "bump_type=major" >> $env:GITHUB_OUTPUT
38+ elif echo "$LABELS" | grep -q "Minor"; then
39+ echo "bump_type=minor" >> $env:GITHUB_OUTPUT
40+ elif echo "$LABELS" | grep -q "Patch"; then
41+ echo "bump_type=patch" >> $env:GITHUB_OUTPUT
42+ else
43+ echo "bump_type=" >> $env:GITHUB_OUTPUT
44+ fi
45+
2146 - name : Bump Version
47+ if : steps.detect-bump.outputs.bump_type != ''
2248 id : bump-version
23- uses : conjikidow/bump-version@v2.0.0
24- with :
25- label-major : ' Major'
26- label-minor : ' Minor'
27- label-patch : ' Patch'
28- create-release : ' false'
49+ run : |
50+ uv run bump-my-version bump ${{ steps.detect-bump.outputs.bump_type }}
51+ $NEW_VERSION = uv run python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])"
52+ echo "version-bumped=true" >> $env:GITHUB_OUTPUT
53+ echo "new-version=$NEW_VERSION" >> $env:GITHUB_OUTPUT
2954
30- - name : Auto-merge pull request
55+ - name : Create version bump PR
3156 if : steps.bump-version.outputs.version-bumped == 'true'
32- run : gh pr merge --squash --auto "${{ github.event.pull_request.number }}"
57+ run : |
58+ git config --local user.email "action@github.com"
59+ git config --local user.name "GitHub Action"
60+
61+ $BRANCH_NAME = "bump-version-${{ steps.bump-version.outputs.new-version }}"
62+ git checkout -b "$BRANCH_NAME"
63+ git add pyproject.toml
64+ git commit -m "chore: bump version to ${{ steps.bump-version.outputs.new-version }}"
65+ git push origin "$BRANCH_NAME"
66+
67+ gh pr create \
68+ --title "chore: bump version to ${{ steps.bump-version.outputs.new-version }}" \
69+ --body "Automated version bump to ${{ steps.bump-version.outputs.new-version }}" \
70+ --base master \
71+ --admin
3372 env :
3473 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
35-
36- - name : Debug outputs
37- run : |
38- echo "version-bumped=${{ steps.bump-version.outputs.version-bumped }}"
39- echo "new-version=${{ steps.bump-version.outputs.new-version }}"
0 commit comments