Skip to content

Commit 427dd75

Browse files
Merge pull request #1572 from datajoint/fix/maint-0.14-pypi-upload
ci(maint/0.14): upload to PyPI from the runner instead of docker compose
2 parents 9f0a8ee + 35d237e commit 427dd75

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

‎.github/workflows/post_draft_release_published.yaml‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,28 +81,19 @@ jobs:
8181
env:
8282
RELEASE_NAME: ${{ github.event.release.name }}
8383
run: |
84-
export HOST_UID=$(id -u)
84+
python -m pip install --upgrade twine
8585
if [[ "$RELEASE_NAME" =~ ^Test ]]; then
86-
LATEST_PYPI=$(curl -s https://test.pypi.org/pypi/datajoint/json | jq -r '.info.version')
8786
echo "TEST_PYPI=true" >> $GITHUB_ENV
8887
export TWINE_REPOSITORY="testpypi"
8988
export TWINE_USERNAME=${TWINE_TEST_USERNAME}
9089
export TWINE_PASSWORD=${TWINE_TEST_PASSWORD}
9190
else
92-
LATEST_PYPI=$(curl -s https://pypi.org/pypi/datajoint/json | jq -r '.info.version')
9391
echo "TEST_PYPI=false" >> $GITHUB_ENV
9492
export TWINE_REPOSITORY="pypi"
9593
fi
96-
# Check if the new version is different from the latest on PyPI, avoid re-uploading error
97-
if [ "$NEW_VERSION" != "$LATEST_PYPI" ]; then
98-
docker compose run --build --quiet-pull \
99-
-e TWINE_USERNAME=${TWINE_USERNAME} \
100-
-e TWINE_PASSWORD=${TWINE_PASSWORD} \
101-
-e TWINE_REPOSITORY=${TWINE_REPOSITORY} \
102-
app sh -c "pip install twine && python -m twine upload dist/*"
103-
else
104-
echo "::warning::Latest version $LATEST_PYPI on $TWINE_REPOSITORY is the new version $NEW_VERSION"
105-
fi
94+
# Upload the artifacts built in the previous step. --skip-existing
95+
# keeps re-runs idempotent (no error if the version already exists).
96+
python -m twine upload --skip-existing dist/*
10697
# Upload package as release assets
10798
- name: Upload pip wheel asset to release
10899
uses: actions/upload-release-asset@v1
@@ -130,7 +121,7 @@ jobs:
130121
gh pr create \
131122
--title "[github-actions]Update version.py to ${{ github.event.release.name }}" \
132123
--body "This PR updates \`version.py\` to match the latest release: ${{ github.event.release.name }}" \
133-
--base master \
124+
--base maint/0.14 \
134125
--head ${{ env.BRANCH_NAME }} \
135126
--reviewer dimitri-yatsenko,drewyangdev,ttngu207
136127
- name: Post release notification to Slack

0 commit comments

Comments
 (0)