From 36df5b5e69121746a81ba4b73de4bde83ef4ee57 Mon Sep 17 00:00:00 2001 From: Alessio Bogon <778703+youtux@users.noreply.github.com> Date: Thu, 26 Sep 2024 21:07:49 +0200 Subject: [PATCH] Add CI action for publishing artifacts to PyPI --- .github/workflows/main.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1f844e4..846189b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -88,3 +88,32 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} fail_ci_if_error: false verbose: true # optional (default = false) + + pypi-publish: + name: Upload release to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/pytest-bdd + permissions: + id-token: write # IMPORTANT: this permission is mandatory for trusted publishing + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') + needs: test-run + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Publish package distributions to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ +# - name: Publish package distributions to PyPI +# uses: pypa/gh-action-pypi-publish@release/v1