From f259d24a6f33f39660d48532b69947d5457ab140 Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Thu, 16 May 2024 14:54:35 +0200 Subject: [PATCH 1/2] CI: fix publishing of PyPI package --- .github/workflows/publish.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 405948e..904d050 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,16 +21,14 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install build twine virtualenv + pip install build virtualenv # PyPI package - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python -m build - python -m twine upload dist/* + - name: Build Python package + run: python -m build + + - name: Publish Python package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 # Github release - name: Read CHANGELOG @@ -38,13 +36,14 @@ jobs: run: | # Get bullet points from last CHANGELOG entry CHANGELOG=$(git diff -U0 HEAD^ HEAD | grep '^[+][\* ]' | sed 's/\+//') - # Support for multiline, see - # https://github.com/actions/create-release/pull/11#issuecomment-640071918 - CHANGELOG="${CHANGELOG//'%'/'%25'}" - CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" - CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" echo "Got changelog: $CHANGELOG" - echo "body=$CHANGELOG" >> $GITHUB_OUTPUT + # Support for multiline, see + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings + { + echo 'body<> "$GITHUB_OUTPUT" - name: Create release on Github id: create_release From 62f91e04cc09fe187bc51c1add66a0cb18294dd2 Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Thu, 16 May 2024 14:58:18 +0200 Subject: [PATCH 2/2] Add further needed updates --- .github/workflows/publish.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 904d050..fd6b0a8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,6 +8,13 @@ on: jobs: deploy: runs-on: ubuntu-latest + environment: release + permissions: + contents: write + id-token: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + steps: - uses: actions/checkout@v4 with: