diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 79a51344..40007d2c 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -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 diff --git a/release_process.md b/release_process.md index effaa8dd..2737ebfb 100644 --- a/release_process.md +++ b/release_process.md @@ -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.