Skip to content

Commit f7cd794

Browse files
committed
CI: prepare workflow for trusted publishing
1 parent bd68902 commit f7cd794

1 file changed

Lines changed: 59 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Build and publish Python distributions
2+
3+
# Build distributions on every push. Only tagged versions will be published.
4+
on: push
5+
6+
jobs:
7+
build:
8+
name: Build distribution
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v6
13+
with:
14+
persist-credentials: false
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v6
18+
with:
19+
python-version: "3.x"
20+
21+
- name: Install build tools
22+
run: python3 -m pip install build --user
23+
24+
- name: Build source tarball and binary wheel
25+
run: python3 -m build
26+
27+
- name: Store the distribution packages
28+
uses: actions/upload-artifact@v5
29+
with:
30+
name: python-package-distributions
31+
path: dist/
32+
33+
publish-to-pypi:
34+
name: Publish to PyPI
35+
36+
# Only publish for version tags.
37+
if: startsWith(github.ref, 'refs/tags/v')
38+
39+
needs:
40+
- build
41+
42+
runs-on: ubuntu-latest
43+
44+
environment:
45+
name: pypi
46+
url: https://pypi.org/p/matplotlib-pgfutils
47+
48+
permissions:
49+
id-token: write
50+
51+
steps:
52+
- name: Download the built distributions
53+
uses: actions/download-artifact@v6
54+
with:
55+
name: python-package-distributions
56+
path: dist/
57+
58+
- name: Publish distributions to PyPI
59+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)