Skip to content

Commit ad490ec

Browse files
committed
First go at a publish action
1 parent 6add51a commit ad490ec

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/pypi.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish Python 🐍 distributions 📦 to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
id-token: write
9+
contents: read
10+
11+
jobs:
12+
build-and-publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.13"
22+
23+
- name: Install build dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install build toml
27+
28+
- name: Set version from tag
29+
run: |
30+
VERSION=${GITHUB_REF#refs/tags/}
31+
echo "Setting version to $VERSION in pyproject.toml"
32+
python -c "import toml; f='pyproject.toml'; d=toml.load(f); d['project']['version']='$VERSION'; toml.dump(d, open(f, 'w'))"
33+
34+
- name: Build package
35+
run: |
36+
python -m build
37+
38+
- name: Publish to PyPI via Trusted Publisher (OIDC)
39+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)