From c56f596ef956c7892f38f859c0c3b113dd7876d7 Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Tue, 28 Nov 2023 16:24:47 +0100 Subject: [PATCH] CI: fix publishing to PyPI with 2FA (#123) --- .github/workflows/publish.yml | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1c4b400..0a9f86c 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@v3 with: @@ -19,15 +26,12 @@ 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 # Docuemntation - name: Install doc dependencies run: |