@@ -50,34 +50,24 @@ jobs:
5050 python -m build .
5151 echo "DJ_WHEEL_PATH=$(ls dist/datajoint-*.whl)" >> $GITHUB_ENV
5252 echo "DJ_SDIST_PATH=$(ls dist/datajoint-*.tar.gz)" >> $GITHUB_ENV
53- echo "NEW_VERSION=${{github.event.release.resolved_version}}" >> $GITHUB_ENV
5453 - name : Publish package
5554 id : publish
5655 env :
5756 RELEASE_NAME : ${{ github.event.release.name }}
5857 run : |
59- export HOST_UID=$(id -u)
58+ python -m pip install --upgrade twine
6059 if [[ "$RELEASE_NAME" =~ ^Test ]]; then
61- LATEST_PYPI=$(curl -s https://test.pypi.org/pypi/datajoint/json | jq -r '.info.version')
6260 echo "TEST_PYPI=true" >> $GITHUB_ENV
6361 export TWINE_REPOSITORY="testpypi"
6462 export TWINE_USERNAME=${TWINE_TEST_USERNAME}
6563 export TWINE_PASSWORD=${TWINE_TEST_PASSWORD}
6664 else
67- LATEST_PYPI=$(curl -s https://pypi.org/pypi/datajoint/json | jq -r '.info.version')
6865 echo "TEST_PYPI=false" >> $GITHUB_ENV
6966 export TWINE_REPOSITORY="pypi"
7067 fi
71- # Check if the new version is different from the latest on PyPI, avoid re-uploading error
72- if [ "$NEW_VERSION" != "$LATEST_PYPI" ]; then
73- docker compose run --build --quiet-pull \
74- -e TWINE_USERNAME=${TWINE_USERNAME} \
75- -e TWINE_PASSWORD=${TWINE_PASSWORD} \
76- -e TWINE_REPOSITORY=${TWINE_REPOSITORY} \
77- app sh -c "pip install twine && python -m twine upload dist/*"
78- else
79- echo "::warning::Latest version $LATEST_PYPI on $TWINE_REPOSITORY is the new version $NEW_VERSION"
80- fi
68+ # Upload the artifacts built in the previous step. --skip-existing
69+ # keeps re-runs idempotent (no error if the version already exists).
70+ python -m twine upload --skip-existing dist/*
8171 # Upload package as release assets
8272 - name : Upload pip wheel asset to release
8373 uses : actions/upload-release-asset@v1
0 commit comments