2020 - uses : actions/checkout@v4
2121 with :
2222 fetch-depth : 0
23- token : ${{ secrets.GITHUB_TOKEN }}
2423
2524 - name : Set up Python
2625 uses : actions/setup-python@v5
@@ -33,66 +32,21 @@ jobs:
3332 pip install build twine python-semantic-release
3433 pip install -r utils/requirements.txt
3534
36- - name : Configure Git
37- run : |
38- git config user.name "github-actions[bot]"
39- git config user.email "github-actions[bot]@users.noreply.github.com"
40-
41- - name : Run semantic release
35+ - name : Create stable release
4236 id : release
4337 env :
4438 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4539 run : |
46- set +e
47- python -m semantic_release version --no-push
48- RELEASE_EXIT_CODE=$?
49- set -e
50-
51- if [ $RELEASE_EXIT_CODE -eq 0 ]; then
52- echo "version_created=true" >> $GITHUB_OUTPUT
53- # Get the new version
54- NEW_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
55- echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
56- echo "New version: $NEW_VERSION"
57-
58- # Push changes
59- git push origin release --tags
60- else
61- echo "version_created=false" >> $GITHUB_OUTPUT
62- echo "No new version created (exit code: $RELEASE_EXIT_CODE)"
63- fi
40+ semantic-release version --commit --tag --push
41+ echo "released=$?" >> $GITHUB_OUTPUT
6442
6543 - name : Build package
66- if : steps.release.outputs.version_created == 'true '
44+ if : steps.release.outputs.released == '0 '
6745 run : bash utils/build_package.sh
6846
69- - name : Check distribution files
70- if : steps.release.outputs.version_created == 'true'
71- run : |
72- ls -lah dist/
73- echo "Files to be uploaded:"
74- find dist/ -type f
75-
7647 - name : Publish to PyPI
77- if : steps.release.outputs.version_created == 'true '
48+ if : steps.release.outputs.released == '0 '
7849 uses : pypa/gh-action-pypi-publish@release/v1
7950 with :
8051 packages-dir : dist/
81- skip-existing : true
82- verbose : true
83-
84- - name : Summary
85- if : steps.release.outputs.version_created == 'true'
86- run : |
87- echo "## 🚀 Release Published" >> $GITHUB_STEP_SUMMARY
88- echo "Version: ${{ steps.release.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY
89- echo "Package: https://pypi.org/project/universalpython/${{ steps.release.outputs.new_version }}/" >> $GITHUB_STEP_SUMMARY
90-
91- - name : No release needed
92- if : steps.release.outputs.version_created != 'true'
93- run : |
94- echo "## ℹ️ No Release Created" >> $GITHUB_STEP_SUMMARY
95- echo "No new version was created. Make sure you have commits following conventional commit format:" >> $GITHUB_STEP_SUMMARY
96- echo "- \`feat:\` for new features (minor version bump)" >> $GITHUB_STEP_SUMMARY
97- echo "- \`fix:\` for bug fixes (patch version bump)" >> $GITHUB_STEP_SUMMARY
98- echo "- \`BREAKING CHANGE:\` in commit body for major version bump" >> $GITHUB_STEP_SUMMARY
52+ skip-existing : true
0 commit comments