Skip to content

Commit 37db69c

Browse files
authored
Merge pull request #57 from openworm/copilot/add-python-publish-workflow
Add python-publish.yml workflow to publish package to PyPI via Trusted Publisher
2 parents 07fbc74 + b915974 commit 37db69c

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish Python package to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
name: Build distribution
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.x"
22+
23+
- name: Install build dependencies
24+
run: python -m pip install build
25+
26+
- name: Build package
27+
run: python -m build
28+
29+
- name: Upload distribution artifacts
30+
uses: actions/upload-artifact@v4
31+
with:
32+
name: python-package-distributions
33+
path: dist/
34+
35+
publish-to-pypi:
36+
name: Publish to PyPI
37+
needs: build
38+
runs-on: ubuntu-latest
39+
environment:
40+
name: pypi
41+
url: https://pypi.org/p/cect
42+
permissions:
43+
id-token: write # Required for Trusted Publisher (OIDC)
44+
45+
steps:
46+
- name: Download distribution artifacts
47+
uses: actions/download-artifact@v4
48+
with:
49+
name: python-package-distributions
50+
path: dist/
51+
52+
- name: Publish to PyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)