ci: drop unsupported --skip-existing from twine upload
Gitea's PyPI registry rejects twine's --skip-existing flag (UnsupportedConfiguration), which failed every publish run. Remove it and instead tolerate an "already exists" conflict in the shell, so dev (unique .devN versions) always publishes and a main re-run of an existing release is treated as success rather than a hard failure. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 file changed
+15
-3
+15
-3
@@ -74,8 +74,20 @@ jobs:
|
|||||||
TWINE_USERNAME: ${{ github.actor }}
|
TWINE_USERNAME: ${{ github.actor }}
|
||||||
TWINE_PASSWORD: ${{ secrets.PACKAGE_REGISTRY_TOKEN || secrets.GITHUB_TOKEN }}
|
TWINE_PASSWORD: ${{ secrets.PACKAGE_REGISTRY_TOKEN || secrets.GITHUB_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
uvx twine upload \
|
# Gitea's PyPI registry does not support twine's --skip-existing, so
|
||||||
|
# we run a plain upload and tolerate an "already exists" conflict in
|
||||||
|
# the shell (dev versions are unique per run, so this only bites a
|
||||||
|
# main re-run of an already-published release).
|
||||||
|
set +e
|
||||||
|
out=$(uvx twine upload \
|
||||||
--repository-url "${{ github.server_url }}/api/packages/${{ github.repository_owner }}/pypi" \
|
--repository-url "${{ github.server_url }}/api/packages/${{ github.repository_owner }}/pypi" \
|
||||||
--non-interactive \
|
--non-interactive \
|
||||||
--skip-existing \
|
--verbose \
|
||||||
dist/*
|
dist/* 2>&1)
|
||||||
|
code=$?
|
||||||
|
echo "$out"
|
||||||
|
if [ $code -ne 0 ] && echo "$out" | grep -qiE "already exist|conflict|409"; then
|
||||||
|
echo "::notice::Version already published — treating as success."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit $code
|
||||||
Reference in new issue
Block a user