Skip to content

Commit 0100cc0

Browse files
kmjones1979claude
andcommitted
ci: guard the PyPI publish against a duplicate version
PyPI does not allow reusing a version number, so a publish of a version that is already on the index fails at the index and a bad artifact cannot be replaced. The check now happens before the upload, alongside a twine check of the built artifacts. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019d5ks2kCa4eXD1ftdkECPu
1 parent 32bf8bd commit 0100cc0

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,14 @@ jobs:
3636
pip install twine
3737
twine check dist/*
3838
39+
40+
- name: Refuse to publish a version that is already on PyPI
41+
run: |
42+
VERSION=$(python -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
43+
if curl -sf "https://pypi.org/pypi/oneclaw/$VERSION/json" >/dev/null 2>&1; then
44+
echo "oneclaw $VERSION is already published. Bump the version in pyproject.toml."
45+
exit 1
46+
fi
47+
echo "oneclaw $VERSION is not on PyPI yet."
3948
- name: Publish
4049
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)