From 1b74d08d8eaad9490cedad50cd5474bedb44a996 Mon Sep 17 00:00:00 2001 From: Daniel Huppmann Date: Wed, 5 Aug 2026 22:34:44 +0200 Subject: [PATCH] Fix pyproject-toml and update publish action --- .github/workflows/publish.yml | 52 ++++++++++++++++++++--------------- pyproject.toml | 6 ++-- 2 files changed, 33 insertions(+), 25 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7d1811673..d6e5ddc6e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,50 +1,58 @@ -name: publish +# Workflow created according to: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ +name: Publish to PyPI and TestPyPI + on: push: - # build the package on any push to a release-candidate branch - branches: [ "release/rc_v*" ] - # deploy to test-pypi on any push of a version tag tags: [ "v*" ] release: - # deploy to pypi when publishing a new release - types: [ published ] + types: [ "published" ] jobs: - publish: + build-n-publish: + name: Build and publish Python distributions to PyPI and TestPyPI runs-on: ubuntu-latest + permissions: + id-token: write steps: - - uses: actions/checkout@v7 + - name: Check out repository + uses: actions/checkout@v7 - - uses: actions/setup-python@v7 + - name: Set up python + id: setup-python + uses: actions/setup-python@v6 + with: + python-version: "3.14" #------------------------------ # install & configure poetry #------------------------------ + - name: Install Poetry uses: snok/install-poetry@v1 with: - version: 2.1.2 + version: 2.1.1 virtualenvs-create: true virtualenvs-in-project: true installer-parallel: true + - name: Install poetry dynamic versioning plugin run: poetry self add "poetry-dynamic-versioning[plugin]" + - name: Build package run: poetry build - - name: Publish to TestPyPI - uses: pypa/gh-action-pypi-publish@v1.13.0 - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - with: - user: __token__ - password: ${{ secrets.TESTPYPI_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + #------------------------------ + # publish to pypi + #------------------------------ + + - if: github.event_name == 'release' + name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 - - name: Publish to PyPI - uses: pypa/gh-action-pypi-publish@v1.13.0 - if: github.event_name == 'release' + - if: github.event_name != 'release' + name: Publish distribution to Test PyPI + uses: pypa/gh-action-pypi-publish@release/v1 with: - user: __token__ - password: ${{ secrets.PYPI_TOKEN }} + repository-url: https://test.pypi.org/legacy/ diff --git a/pyproject.toml b/pyproject.toml index db111a261..651164898 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,13 +53,13 @@ dependencies = [ "wquantiles>=0.6", "XlsxWriter>=3.0.3", ] -dynamic = [] -version = "3.4.0.post3.dev0+603330e" +dynamic = ["version"] [tool.poetry] documentation = "https://pyam-iamc.readthedocs.io" packages = [{ include = "pyam" }] requires-poetry = ">=2.0,<3.0" +version = "0.0.0" [tool.poetry.group.dev] optional = true @@ -183,6 +183,6 @@ max-complexity = 10 poetry-dynamic-versioning = { version = ">=1.0.0,<2.0.0", extras = ["plugin"] } [tool.poetry-dynamic-versioning] -enable = false +enable = true style = "pep440" vcs = "git"