From ea560669759a4e57c14b0888eb983ad25c2d6848 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> Date: Fri, 29 Dec 2023 09:16:27 +0100 Subject: [PATCH] chore: fix pypi.org publishing (#708) --- .github/workflows/publish-dev-release-to-pypi.yml | 15 ++++++++++++--- .github/workflows/publish-release-to-pypi.yml | 13 +++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish-dev-release-to-pypi.yml b/.github/workflows/publish-dev-release-to-pypi.yml index 47d6d928d..d75181add 100644 --- a/.github/workflows/publish-dev-release-to-pypi.yml +++ b/.github/workflows/publish-dev-release-to-pypi.yml @@ -9,10 +9,18 @@ on: env: TOKEN: ${{ secrets.GH_TOKEN }} + # API tokens require username "__token__". + # Repo names other than pypi.org must be configured with: + # % poetry config repositories.testpypi https://test.pypi.org/legacy/ + # and the env vars must be named accordingly: + # - POETRY_HTTP_BASIC__USERNAME + # - POETRY_PYPI_TOKEN_ + POETRY_HTTP_BASIC_PYPI_USERNAME: __token__ + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_DASCHBOT_TOKEN }} jobs: publish-dev-release-to-pypi: - if: github.event.pull_request.merged == true && (contains(github.event.pull_request.title, 'fix') || contains(github.event.pull_request.title, 'feat')) + if: github.event.pull_request.merged == true && (startsWith(github.event.pull_request.title, 'fix') || startsWith(github.event.pull_request.title, 'feat')) runs-on: ubuntu-latest steps: - name: Check out repo @@ -30,8 +38,9 @@ jobs: poetry self add poetry-exec-plugin - name: bump version in pyproject.toml run: poetry exec bump-version - - name: publish new version to PyPI + - name: build wheel run: | rm -rf dist/ build/ poetry build - poetry publish -u=__token__ -p=${{ secrets.PYPI_DASCHBOT_TOKEN }} + - name: publish new version to PyPI + run: poetry publish diff --git a/.github/workflows/publish-release-to-pypi.yml b/.github/workflows/publish-release-to-pypi.yml index efbeff844..1bfde416f 100644 --- a/.github/workflows/publish-release-to-pypi.yml +++ b/.github/workflows/publish-release-to-pypi.yml @@ -8,6 +8,14 @@ on: env: TOKEN: ${{ secrets.GH_TOKEN }} + # API tokens require username "__token__". + # Repo names other than pypi.org must be configured with: + # % poetry config repositories.testpypi https://test.pypi.org/legacy/ + # and the env vars must be named accordingly: + # - POETRY_HTTP_BASIC__USERNAME + # - POETRY_PYPI_TOKEN_ + POETRY_HTTP_BASIC_PYPI_USERNAME: __token__ + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_DASCHBOT_TOKEN }} jobs: publish-release-to-pypi: @@ -25,11 +33,12 @@ jobs: run: | curl -sSL https://install.python-poetry.org | python3 - poetry install - - name: publish new version to PyPI + - name: build wheel run: | rm -rf dist/ build/ poetry build - poetry publish -u=__token__ -p=${{ secrets.PYPI_DASCHBOT_TOKEN }} + - name: publish new version to PyPI + run: poetry publish notification: name: Google chat notification about release and published version