2828 - name : Install dependencies
2929 run : |
3030 python -m pip install --upgrade pip
31- pip install build twine python-semantic-release setuptools-scm
31+ pip install build twine python-semantic-release>=9.0.0 setuptools-scm
3232
3333 - name : Create release branch
3434 run : |
@@ -37,14 +37,19 @@ jobs:
3737 git checkout -b release-main
3838 git push --set-upstream origin release-main
3939
40- - name : Run semantic-release
40+ - name : Run semantic-release version on release-main branch
4141 env :
4242 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43- # Set the branch via environment variable
44- SEMANTIC_RELEASE_BRANCH : release-main
4543 run : |
46- semantic-release version
47- semantic-release publish
44+ semantic-release --verbose version
45+
46+ # For semantic-release 9.x, the publish command needs to be run separately
47+ - name : Run semantic-release publish
48+ env :
49+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
50+ PYPI_TOKEN : ${{ secrets.PYPI_API_TOKEN }}
51+ run : |
52+ semantic-release --verbose publish
4853
4954 - name : Push release branch
5055 run : git push origin release-main
@@ -59,46 +64,13 @@ jobs:
5964 --title "Automated Release Updates" \
6065 --body "This pull request contains updates from the semantic-release process." || true
6166
62- - name : Build package
63- run : python -m build
64-
65- - name : Publish package to PyPI
67+ # This is only needed if semantic-release publish didn't handle the PyPI upload
68+ - name : Build and publish package to PyPI if needed
6669 env :
6770 TWINE_USERNAME : __token__
6871 TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
69- run : twine upload dist/*
70- # create-pr-back-to-master:
71- # needs: release
72- # runs-on: ubuntu-latest
73- # permissions:
74- # contents: write
75- # pull-requests: write
76- # steps:
77- # - name: Checkout code
78- # uses: actions/checkout@v3
79- # with:
80- # fetch-depth: 0
81- # ref: main
82-
83- # - name: Set Git Identity
84- # run: |
85- # git config --global user.name 'GitHub Actions'
86- # git config --global user.email 'github-actions@github.com'
87-
88- # - name: Create Pull Request from main to master
89- # env:
90- # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91- # run: |
92- # git fetch origin master:refs/remotes/origin/master
93- # DIFF_COUNT=$(git rev-list --count origin/master..HEAD)
94- # if [ "$DIFF_COUNT" -gt 0 ]; then
95- # echo "Differences found between main and master. Creating PR..."
96- # gh pr create \
97- # --base master \
98- # --head main \
99- # --title "Sync master with main after release" \
100- # --body "This is an automated PR to sync changes from main back to master after a release." || true
101- # echo "Pull request created or already exists."
102- # else
103- # echo "No differences found between main and master. Skipping PR creation."
104- # fi
72+ run : |
73+ if [ ! -f "dist/*" ]; then
74+ python -m build
75+ twine upload dist/*
76+ fi
0 commit comments