Skip to content

Commit d7ba13d

Browse files
authored
Python: Replace publish action (#180)
Replaces `cucumber/action-publish-pypi` with `pypa/gh-action-pypi-publish@release/v1`. The motivation for using actions in the cucumber org is to ensure that we do not hand release tokens to untrusted code. As the party publishing our python packages, the Python Package Authority can be trusted. Additionally, their action uses trusted publishers which authorizes GitHub with OIDC so no long-lived tokens are used.
1 parent adaeef2 commit d7ba13d

File tree

2 files changed

+32
-20
lines changed

2 files changed

+32
-20
lines changed

.github/workflows/release-pypi.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ jobs:
2323
python-version: "3.10"
2424
- name: Show Python version
2525
run: python --version
26-
- uses: cucumber/[email protected]
26+
27+
- name: Build package
28+
run: |
29+
python -m pip install build twine
30+
python -m build
31+
twine check --strict dist/*
32+
33+
- name: Publish package distributions to PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1
2735
with:
28-
working-directory: "python"
36+
packages-dir: python/dist

.github/workflows/test-python.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
name: test-python
2-
defaults:
3-
run:
4-
working-directory: python
52

63
on:
74
push:
@@ -21,19 +18,26 @@ jobs:
2118
os:
2219
- ubuntu-latest
2320
python-version: ["3.x","pypy-3.10"]
21+
defaults:
22+
run:
23+
working-directory: python
2424
steps:
25-
- uses: actions/checkout@v4
26-
- name: Set up Python
27-
uses: actions/setup-python@v5
28-
with:
29-
python-version: ${{ matrix.python-version }}
30-
architecture: x64
31-
- name: Show Python version
32-
run: python --version
33-
- name: Install Python package dependencies
34-
run: |
35-
python -m pip install -U pip setuptools wheel
36-
pip install -U -r py.requirements/ci.github.testing.txt
37-
pip install -e .
38-
- name: Run tests
39-
run: pytest
25+
- uses: actions/checkout@v4
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
architecture: x64
31+
- name: Show Python version
32+
run: python --version
33+
- name: Install Python package dependencies
34+
run: |
35+
python -m pip install pip setuptools wheel build twine
36+
pip install -U -r py.requirements/ci.github.testing.txt
37+
pip install -e .
38+
- name: Run tests
39+
run: pytest
40+
- name: Build package
41+
run: |
42+
python -m build
43+
twine check --strict dist/*

0 commit comments

Comments
 (0)