Skip to content

Commit 7d52df7

Browse files
committed
CI: Ignore version duplicates when publishing to TestPyPI
This commit prevents the failure of the GitHub Actions job "Publish distribution package to TestPyPI" on most pushes (see discussion at #721 (comment)), since recent commit a3e1325 "CI: Publish PyPI releases using GitHub Actions workflows". Indeed, TestPyPI doesn't allow repushing the same version. Use `skip-existing` to prevent to such failures on the CI. An alternative would be to use the `setuptools-scm` plugin to define a unique version for each commit (e.g. `1.36.2.dev2+gd4f1c14`), but it requires more changes (define the version in `pyproject.toml`, fetch tags from GitHub in `publish.yaml`, exclude `.*` + `.github/**` files in `MANIFEST.in`). Moreover it doesn't work as is: to prevent errors like `HTTP 400 The use of local versions in '1.36.2.dev2+gd4f1c14' is not allowed` we would need `local_scheme = "no-local-version"`, which would push duplicated versions on TestPyPI anyway.
1 parent 16727ac commit 7d52df7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

.github/workflows/publish.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
uses: pypa/gh-action-pypi-publish@release/v1
4747
with:
4848
repository-url: https://test.pypi.org/legacy/
49+
skip-existing: true
4950

5051
publish-to-pypi:
5152
name: Publish distribution package to PyPI

0 commit comments

Comments
 (0)