Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
zakiali committed Aug 28, 2024
1 parent 93d810f commit 9cc2fe5
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/pypi_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- '**'
tags:
- 'v*'

Expand All @@ -26,17 +27,24 @@ jobs:
- 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"
echo $GITHUB_REF_TYPE;
if [ "$GITHUB_REF_TYPE" == "tag" ]; then
NEW_VERSION=$(echo "$GITHUB_REF" | sed -E 's/refs\/tags\/v(.+)/\1/')
CURRENT_VERSION=$(grep '^version =' pyproject.toml | sed -E 's/version = "(.*)"/\1/')
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 "new_version=true" >> $GITHUB_ENV
else
echo "new_version=false" >> $GITHUB_ENV
fi
else
echo "::set-output name=new_version::false"
echo "new_version=false" >> $GITHUB_ENV
fi
- 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 }}
password: ${{ secrets.PYPI_TOKEN_TEMP_DOES_NOT_EXIST }}
packages_dir: ./dist/

0 comments on commit 9cc2fe5

Please sign in to comment.