From 86ecb1f5adf6a9609dfcb5b2f77978257bf54c77 Mon Sep 17 00:00:00 2001 From: unexcellent <> Date: Tue, 19 Nov 2024 10:00:50 +0100 Subject: [PATCH 1/2] build: try to make publish action dependent on version change --- .github/workflows/publish.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7acf9f4..297cbcb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -35,16 +35,20 @@ jobs: - name: Build the package run: poetry build - - name: Get current version from pyproject.toml - id: get_version - run: echo "VERSION=$(poetry version -s)" >> $GITHUB_ENV - - - name: Check last version on PyPI - id: check_pypi_version + - name: Check if version exists on PyPI + id: check-version run: | - LAST_VERSION=$(curl -s https://pypi.org/pypi//json | jq -r .info.version) - echo "LAST_VERSION=$LAST_VERSION" >> $GITHUB_ENV + PACKAGE_NAME=$(poetry version | awk '{print $1}') + PACKAGE_VERSION=$(poetry version | awk '{print $2}') + RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" https://pypi.org/pypi/$PACKAGE_NAME/$PACKAGE_VERSION/json) + if [ "$RESPONSE" == "200" ]; then + echo "Version $PACKAGE_VERSION already exists on PyPI. Skipping publish step." + echo "exists=true" >> $GITHUB_ENV + else + echo "exists=false" >> $GITHUB_ENV + fi + shell: bash - name: Publish to PyPI (release only) - if: env.VERSION != env.LAST_VERSION + if: env.exists == 'false' run: poetry publish --no-interaction --username __token__ --password ${{ secrets.PYPI_TOKEN }} From 491b076435b19903cefb4e39f965be35fc61c14d Mon Sep 17 00:00:00 2001 From: unexcellent <> Date: Tue, 19 Nov 2024 10:01:54 +0100 Subject: [PATCH 2/2] chore: publish v0.9.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index dd14de0..461c3a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "quantio" -version = "0.9.0" +version = "0.9.1" description = "Type hinting and safe unit conversion for physical quantities in Python." authors = [] readme = "README.md"