Skip to content

Commit 4973933

Browse files
committed
Add GitHub release step to workflow
Clarify the existing step name to 'Build and publish to PyPI' and add a new CI step that tags the repo and creates a GitHub Release using the built dist/* artifacts. The new step uses GH_TOKEN and the version from steps.version_check.outputs.version to push a v<version> tag and run `gh release create`, automating GitHub releases whenever the package version changes.
1 parent 771b937 commit 4973933

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,22 @@ jobs:
3434
run: |
3535
python -m pip install --upgrade pip
3636
pip install setuptools wheel twine
37-
- name: Build and publish
37+
- name: Build and publish to PyPI
3838
if: steps.version_check.outputs.changed == 'true'
3939
env:
4040
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
4141
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
4242
run: |
4343
python setup.py sdist bdist_wheel
4444
twine upload dist/*
45+
- name: Create GitHub Release
46+
if: steps.version_check.outputs.changed == 'true'
47+
env:
48+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
run: |
50+
VERSION=${{ steps.version_check.outputs.version }}
51+
git tag "v${VERSION}"
52+
git push origin "v${VERSION}"
53+
gh release create "v${VERSION}" dist/* \
54+
--title "v${VERSION}" \
55+
--generate-notes

0 commit comments

Comments
 (0)