Add CI action for publishing artifacts to PyPI

This commit is contained in:
Alessio Bogon 2024-09-26 21:07:49 +02:00
parent 8aa7287a0c
commit 36df5b5e69
No known key found for this signature in database
1 changed files with 29 additions and 0 deletions

View File

@ -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