File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments