Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/pypi-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,36 @@ jobs:
runs-on: ubuntu-24.04
if: github.event_name == 'push'
needs: [ build_dist ]
outputs:
release_needed: ${{ steps.release_check.outputs.release_needed }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check release tag
id: release_check
run: |
version=$(grep -oP '__version__ = "\K[^"]+' src/cloudevents/__init__.py)
if git show-ref --verify --quiet "refs/tags/$version"; then
echo "release_needed=false" >> "$GITHUB_OUTPUT"
else
echo "release_needed=true" >> "$GITHUB_OUTPUT"
fi
- uses: actions/download-artifact@v8.0.1
if: steps.release_check.outputs.release_needed == 'true'
with:
name: artifact
path: dist
- name: Publish
if: steps.release_check.outputs.release_needed == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
tag:
runs-on: ubuntu-24.04
needs: [ publish ]
if: needs.publish.outputs.release_needed == 'true'
steps:
- uses: actions/checkout@v6
with:
Expand Down
10 changes: 6 additions & 4 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ package](https://pypi.org/project/cloudevents/) and GitHub Tag via GitHub Action
To release a new CloudEvents SDK, contributors should bump `__version__` in
`src/cloudevents/__init__.py` to reflect the new release version. On merge, the action
will automatically build and release to PyPI. This action gets called on all pushes to main
(such as a version branch being merged into main), but only releases a new version when the
version number has changed. Note, this action assumes pushes to main are version updates.
Consequently, the release workflow will fail if you attempt to push to main without updating
`__version__` in `src/cloudevents/__init__.py` so don't forget to do so.
(such as a version branch being merged into main), but skips publishing and tagging when a
Git tag matching `__version__` already exists. Changes made after a release require a new
version number to be published.

After a version update is merged, a GitHub tag for the new cloudevents version is created
using `__version__`.
If publishing succeeds but tag creation fails, verify the published release and restore its
tag at the release commit before subsequent pushes; otherwise PyPI will reject the repeat
upload.

View the GitHub workflow [pypi-release.yml](.github/workflows/pypi-release.yml) for
more information.
Loading