Skip to content

Commit

Permalink
Fix PyPI version check to handle null responses in workflow (very fir…
Browse files Browse the repository at this point in the history
…st PyPI release)
  • Loading branch information
fox-techniques committed Jan 1, 2025
1 parent c647cd3 commit 273486a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ jobs:
id: check_pypi
run: |
response=$(curl -s https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json || echo "{}")
latest_previous_version=$(echo $response | jq -r '.releases | keys_unsorted | sort | .[-1]')
if [ -z "$latest_previous_version" ]; then
echo "Package not found on PyPI."
latest_previous_version=$(echo "$response" | jq -r '.releases | keys_unsorted | sort | .[-1]' || echo "0.0.0")
if [ -z "$latest_previous_version" ] || [ "$latest_previous_version" == "null" ]; then
latest_previous_version="0.0.0"
fi
echo "latest_previous_version=$latest_previous_version" >> $GITHUB_ENV
Expand Down

0 comments on commit 273486a

Please sign in to comment.