Skip to content

Commit af4abf0

Browse files
author
Drew Yang
committed
feat: 🚀 release + doc flow update
1 parent a04ed74 commit af4abf0

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

‎.github/workflows/docs.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
#- published
1010
## stable release only
1111
- released
12+
run-name: "📚 Release docs ${{ github.event.release.tag_name }}"
1213
jobs:
1314
publish-docs:
1415
runs-on: ubuntu-latest

‎.github/workflows/release.yaml

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,29 @@ jobs:
4747
python -m build .
4848
echo "DJ_WHEEL_PATH=$(ls dist/datajoint-*.whl)" >> $GITHUB_ENV
4949
echo "DJ_SDIST_PATH=$(ls dist/datajoint-*.tar.gz)" >> $GITHUB_ENV
50-
echo "DJ_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)" >> $GITHUB_OUTPUT
51-
# - name: Publish package
52-
# run: |
53-
# export HOST_UID=$(id -u)
54-
# if [ "$TESTPYPI" == "true" ]; then
55-
# export TWINE_REPOSITORY="testpypi"
56-
# export TWINE_USERNAME=${TWINE_TEST_USERNAME}
57-
# export TWINE_PASSWORD=${TWINE_TEST_PASSWORD}
58-
# else
59-
# export TWINE_REPOSITORY="pypi"
60-
# fi
61-
# docker compose run --build --quiet-pull \
62-
# -e TWINE_USERNAME=${TWINE_USERNAME} \
63-
# -e TWINE_PASSWORD=${TWINE_PASSWORD} \
64-
# -e TWINE_REPOSITORY=${TWINE_REPOSITORY} \
65-
# app sh -c "pip install twine && python -m twine upload dist/*"
50+
echo "NEW_VERSION=$(grep -oP '\d+\.\d+\.\d+' datajoint/version.py)" >> $GITHUB_ENV
51+
- name: Publish package
52+
run: |
53+
export HOST_UID=$(id -u)
54+
if [ "$TESTPYPI" == "true" ]; then
55+
LATEST_PYPI=$(curl -s https://test.pypi.org/pypi/datajoint/json | jq -r '.info.version')
56+
export TWINE_REPOSITORY="testpypi"
57+
export TWINE_USERNAME=${TWINE_TEST_USERNAME}
58+
export TWINE_PASSWORD=${TWINE_TEST_PASSWORD}
59+
else
60+
LATEST_PYPI=$(curl -s https://pypi.org/pypi/datajoint/json | jq -r '.info.version')
61+
export TWINE_REPOSITORY="pypi"
62+
fi
63+
# Check if the new version is different from the latest on PyPI, avoid re-uploading error
64+
if [ "$NEW_VERSION" != "$LATEST_PYPI" ]; then
65+
docker compose run --build --quiet-pull \
66+
-e TWINE_USERNAME=${TWINE_USERNAME} \
67+
-e TWINE_PASSWORD=${TWINE_PASSWORD} \
68+
-e TWINE_REPOSITORY=${TWINE_REPOSITORY} \
69+
app sh -c "pip install twine && python -m twine upload dist/*"
70+
else
71+
echo "::warning::The latest version $LATEST_PYPI on $TWINE_REPOSITORY is the new version $NEW_VERSION"
72+
fi
6673
# Drafts your next Release notes as Pull Requests are merged into "master"
6774
- name: Draft release notes
6875
id: create_gh_release

0 commit comments

Comments
 (0)