Skip to content

Commit 36df5b5

Browse files
committed
Add CI action for publishing artifacts to PyPI
1 parent 8aa7287 commit 36df5b5

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

.github/workflows/main.yml

+29
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,32 @@ jobs:
8888
token: ${{ secrets.CODECOV_TOKEN }}
8989
fail_ci_if_error: false
9090
verbose: true # optional (default = false)
91+
92+
pypi-publish:
93+
name: Upload release to PyPI
94+
runs-on: ubuntu-latest
95+
environment:
96+
name: pypi
97+
url: https://pypi.org/p/pytest-bdd
98+
permissions:
99+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
100+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
101+
needs: test-run
102+
steps:
103+
- uses: actions/checkout@v4
104+
- name: Set up Python
105+
uses: actions/setup-python@v5
106+
- name: Install pypa/build
107+
run: >-
108+
python3 -m
109+
pip install
110+
build
111+
--user
112+
- name: Build a binary wheel and a source tarball
113+
run: python3 -m build
114+
- name: Publish package distributions to TestPyPI
115+
uses: pypa/gh-action-pypi-publish@release/v1
116+
with:
117+
repository-url: https://test.pypi.org/legacy/
118+
# - name: Publish package distributions to PyPI
119+
# uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)