From 71f91bc638aff559dd0f17cef181ff29ff863d41 Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Thu, 30 Nov 2023 13:33:10 +0100 Subject: [PATCH] CI: fix publishing to PyPI with 2FA (#63) --- .github/workflows/publish.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 72d0337..00d38a6 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: @@ -29,13 +36,11 @@ jobs: pip install build twine 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 # Documentation - name: Install doc dependencies