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
26 changes: 26 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,29 @@ jobs:
- name: Login
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Check whether the GitHub Release already exists
# Allows re-running the deploy job after a partial failure (e.g. PyPI
# upload error) without the Make Release step failing with HTTP 422
# because the tag/release was created on a prior attempt. Treat
# only the literal `release not found` reply as "does not exist";
# other failures (auth, rate-limit, network) re-raise so the job
# fails loudly instead of falling through to Make Release.
id: gh-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG: ${{ github.ref_name }}
run: |
if gh release view "${TAG}" --repo "${GITHUB_REPOSITORY}" \
>/dev/null 2>err; then
echo 'exists=true' >> "${GITHUB_OUTPUT}"
elif grep -qx 'release not found' err; then
echo 'exists=false' >> "${GITHUB_OUTPUT}"
else
cat err >&2
exit 1
fi
- name: Make Release
if: steps.gh-release.outputs.exists != 'true'
uses: aio-libs/create-release@v1.6.6
with:
changes_file: CHANGES.rst
Expand All @@ -602,6 +624,10 @@ jobs:
- name: >-
Publish 🐍📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# Allow re-running the deploy job after a partial PyPI upload
# without failing on dists that were already published.
skip-existing: true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make this conditional, check the rerun counter GHA puts in the context automatically. The first run shouldn't have this, only restarts.


- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.3.0
Expand Down
5 changes: 5 additions & 0 deletions CHANGES/1353.contrib.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Allowed re-running the deploy job after a partial release failure: the
``Make Release`` step now skips when the GitHub Release already exists,
and the PyPI publish step uses ``skip-existing`` so dists that were
already uploaded on a prior attempt do not break the retry
-- by :user:`bdraco`.
1 change: 1 addition & 0 deletions docs/spelling_wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ deallocation
decrementation
dev
dict
dists
docstrings
downstreams
eof
Expand Down
Loading