Skip to content

Commit ce58ac8

Browse files
fix(publish): make publish-pypi idempotent across two-tag release cycles
release-please-config.json uses include-component-in-tag = true, so each release cycle emits two GitHub release events (agentex-sdk-client-vX.Y.Z and agentex-sdk-vX.Y.Z). Both events fire publish-pypi.yml, which calls this script — the script unconditionally publishes both wheels per run, so the second event's run tries to re-upload artifacts already on PyPI. Under `set -eux`, twine's non-zero exit on a duplicate upload aborts the script and turns the GitHub Action red on every other release cycle. Add --skip-existing to both rye publish invocations. rye 0.44.0 forwards this flag to `python -mtwine upload --skip-existing`; twine then treats already-present files as exit 0 with a WARNING in place of HTTPError. Verified locally against pypiserver: without the flag the second publish exits non-zero, with the flag it logs `WARNING Skipping ... appears to already exist` and exits 0. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 659dd19 commit ce58ac8

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

bin/publish-pypi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ set -eux
2222
# Slim Stainless-managed client (root) — `agentex-sdk-client` on PyPI.
2323
mkdir -p dist
2424
rye build --clean --wheel # --wheel: sdist deferred (see adk/pyproject.toml).
25-
rye publish --yes --token="${AGENTEX_SDK_CLIENT_PYPI_TOKEN:-$PYPI_TOKEN}"
25+
rye publish --yes --skip-existing --token="${AGENTEX_SDK_CLIENT_PYPI_TOKEN:-$PYPI_TOKEN}"
2626

2727
# Heavy ADK overlay (adk/) — `agentex-sdk` on PyPI; pins the slim above.
2828
(
@@ -31,5 +31,5 @@ rye publish --yes --token="${AGENTEX_SDK_CLIENT_PYPI_TOKEN:-$PYPI_TOKEN}"
3131
# --wheel load-bearing: rye's sdist-then-wheel default can't resolve
3232
# the force-include of ../src/agentex/lib → silent empty wheel.
3333
rye build --clean --wheel
34-
rye publish --yes --token="${AGENTEX_PYPI_TOKEN:-$PYPI_TOKEN}"
34+
rye publish --yes --skip-existing --token="${AGENTEX_PYPI_TOKEN:-$PYPI_TOKEN}"
3535
)

0 commit comments

Comments
 (0)