Chore release to use GH release events for PyPI & asset publishing (#2100)

* Chore release to use GH release events for PyPI & asset publishing
* Fix PyPI publish condition to exclude prereleases
* Allow manual triggering of PyPI publish via workflow_dispatch
This commit is contained in:
Jirka Borovec 2026-01-27 15:02:15 +09:00 committed by GitHub
parent c2c7ca03d3
commit 377a87dbba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 6 deletions

View File

@ -1,9 +1,8 @@
name: Publish Supervision Releases to PyPI
on:
push:
tags:
- "[0-9]+.[0-9]+[0-9]+.[0-9]"
release:
types: [published]
workflow_dispatch:
pull_request:
branches: [main, develop]
@ -29,7 +28,7 @@ jobs:
timeout-minutes: 10
permissions:
id-token: write # Required for PyPI publishing
contents: read # Required for checkout
contents: write # Required for checkout and upload assets
steps:
- name: 📥 Download distribution artifacts
uses: actions/download-artifact@v7
@ -39,8 +38,16 @@ jobs:
- name: List distribution artifacts
run: ls -lh dist/
- name: 📦 Upload assets to Release
if: github.event_name == 'release'
uses: AButler/upload-release-assets@v3.0
with:
files: 'dist/*'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: 🚀 Publish to PyPi
if: github.event_name != 'pull_request'
# We only want to publish to PyPi if the event is a release and it's not a pre-release.
if: (github.event_name == 'release' && github.event.release.prerelease != true) || github.event_name == 'workflow_dispatch'
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
with:
attestations: true

View File

@ -14,7 +14,7 @@ It assumes you already have the code changes, as well as a draft of the release
- Run `git tag x.y.z`, with your version
- Check with `git log`.
- Run `git push origin --tags`
- Upon pushing the tag, the [PyPi](https://pypi.org/project/supervision/) should update to the new version. Check this!
- Upon pushing the Github release, the [PyPi](https://pypi.org/project/supervision/) should update to the new version. Check this!
4. Open and merge a PR, merging `main` into `develop`.
5. Update the docs by running the [Supervision Release Documentation Workflow 📚](https://github.com/roboflow/supervision/actions/workflows/publish-release-docs.yml) workflow from GitHub.
- Select the `main` branch from the dropdown.