From f466336ca20a7326efc7fe7c2a07b4a8d6f2b2e1 Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Thu, 30 Nov 2023 13:40:34 +0100 Subject: [PATCH] CI: fix publishing to PyPI with 2FA (#101) --- .github/workflows/publish.yml | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9c29203..6880e00 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,6 +9,12 @@ jobs: build: runs-on: 'ubuntu-latest' + environment: release + permissions: + contents: write + id-token: write + concurrency: + group: ${{ github.workflow }}-${{ github.ref }} strategy: matrix: platform: @@ -72,18 +78,14 @@ jobs: with: python-version: '3.8' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install twine - # PyPI package - - name: Build and publish - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python -m twine upload wheelhouse/* + - name: Build Python package + run: python -m build + + - name: Publish Python package to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: wheelhouse/ # Documentation - name: Setup Ubuntu