Skip to content

Commit

Permalink
chore: Updated publish workflow to only push if version tag updated
Browse files Browse the repository at this point in the history
  • Loading branch information
zakiali committed Aug 28, 2024
1 parent 2865f7b commit 93d810f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/pypi_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,19 @@ jobs:
- name: Build with UV
run: uvx --from build pyproject-build --installer uv

- name: Check version
id: check_version
run: |
NEW_VERSION=$(echo "$GITHUB_REF" | sed -E 's/refs\/tags\/v(.+)/\1/')
CURRENT_VERSION=$(python -c "import toml; from packaging.version import parse as parse_version; print(parse_version(toml.load('pyproject.toml')['project']['version']))")
if python -c "from packaging.version import parse as parse_version; exit(0 if parse_version('$NEW_VERSION') > parse_version('$CURRENT_VERSION') else 1)"; then
echo "::set-output name=new_version::true"
else
echo "::set-output name=new_version::false"
- name: Publish
uses: pypa/[email protected]
if: startsWith(github.ref, 'refs/tags/v') && steps.check_version.outputs.new_version == 'true'
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN_TEMP }}
Expand Down

0 comments on commit 93d810f

Please sign in to comment.