File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 3030 run : |
3131 python -m build
3232
33+ - name : Check if version exists on PyPI
34+ id : check-version
35+ run : |
36+ PKG_NAME=$(python3 -c "import toml; print(toml.load('pyproject.toml')['project']['name'])")
37+ PKG_VERSION=$(python3 -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
38+ EXISTS=$(curl -s https://pypi.org/pypi/$PKG_NAME/json | grep -o "\"$PKG_VERSION\"")
39+ if [ "$EXISTS" != "" ]; then
40+ echo "Version $PKG_VERSION already exists on PyPI. Skipping upload."
41+ echo "skip_upload=true" >> $GITHUB_OUTPUT
42+ else
43+ echo "skip_upload=false" >> $GITHUB_OUTPUT
44+ fi
45+
3346 - name : Publish to PyPI
47+ if : steps.check-version.outputs.skip_upload != 'true'
3448 env :
3549 TWINE_USERNAME : __token__
3650 TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
You can’t perform that action at this time.
0 commit comments