Skip to content

Commit

Permalink
Merge pull request #565 from PacificGilly/jamesgilmore/fix-again-test…
Browse files Browse the repository at this point in the history
…-release-mechanism

Fix again the strategy for determining the latest version released.
  • Loading branch information
farridav committed Apr 22, 2024
2 parents ff15828 + a417f10 commit 19cbb0e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,16 @@ jobs:

- name: Deploy to testpypi.org
run: |
# Using `pypi` rather than our own tags as we don't create a "release" for test version of our package.
LATEST_RELEASE=$(curl -s https://test.pypi.org/rss/project/django-jazzmin/releases.xml | sed -n 's/\s*<title>\([{a,b}0-9.]*\).*/\1/p' | head -n 2 | xargs)
# Need to check both Test PyPi and GH releases as we need to version bump the patch
# version everytime we merge in a PR, but once we release a new production release, we
# need to bump from the new release. So we grab the latest releases from both sources,
# then reverse sort them to get highest version! Simples :D
LATEST_RELEASE_TEST_PYPI=$(curl -s https://test.pypi.org/rss/project/django-jazzmin/releases.xml | sed -n 's/\s*<title>\([{a,b}0-9.]*\).*/\1/p' | head -n 2 | xargs)
LATEST_RELEASE_GITHUB=$(curl -s "https://api.github.com/repos/farridav/django-jazzmin/tags" | jq -r '.[0].name[1:]')
LATEST_RELEASE=$(printf "${LATEST_RELEASE_GITHUB}\n${LATEST_RELEASE_TEST_PYPI}" | sort -V -r)
# Now we can bump the version correctly to release a new version nicely base on the
# latest GH release.
poetry version $LATEST_RELEASE
poetry version prerelease # Using `prerelease` rather than `prepatch` due to a bug in Poetry (latest checked 1.8.1 - https://github.com/python-poetry/poetry/issues/879)
poetry config repositories.test_pypi https://test.pypi.org/legacy/
Expand Down

0 comments on commit 19cbb0e

Please sign in to comment.