File tree Expand file tree Collapse file tree 1 file changed +61
-0
lines changed
Expand file tree Collapse file tree 1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change 1+ # Stage Python source distribution and wheel packages through GitHub Actions (GHA) to Python Package Index (PyPI).
2+ name : " Release: Python package"
3+
4+ on :
5+
6+ # Build and publish packages when running a release.
7+ push :
8+ tags :
9+ - ' *'
10+
11+ # Build packages on each pull request for validation purposes.
12+ pull_request :
13+
14+ # Build packages each night for validation purposes.
15+ schedule :
16+ - cron : ' 0 4 * * *'
17+
18+ # Allow the job to be triggered manually.
19+ workflow_dispatch :
20+
21+ jobs :
22+ build-and-publish :
23+ name : " Build and publish to PyPI"
24+ runs-on : ${{ matrix.os }}
25+ strategy :
26+ fail-fast : false
27+ matrix :
28+ os : ["ubuntu-latest"]
29+ python-version : ["3.13"]
30+ env :
31+ OS_TYPE : ${{ matrix.os }}
32+ PYTHON_VERSION : ${{ matrix.python-version }}
33+ UV_SYSTEM_PYTHON : 1
34+
35+ # Trusted publishing.
36+ # Specifying a GitHub environment is optional, but strongly encouraged
37+ environment : pypi
38+ permissions :
39+ # IMPORTANT: this permission is mandatory for Trusted Publishing
40+ id-token : write
41+
42+ steps :
43+ - name : Acquire sources
44+ uses : actions/checkout@v4
45+
46+ - name : Set up Python
47+ uses : actions/setup-python@v5
48+ with :
49+ python-version : ${{ matrix.python-version }}
50+
51+ - name : Set up uv
52+ uses : astral-sh/setup-uv@v6
53+
54+ - name : Build package
55+ run : |
56+ uv pip install build
57+ python -m build
58+
59+ - name : Publish package to PyPI
60+ if : startsWith(github.event.ref, 'refs/tags')
61+ uses : pypa/gh-action-pypi-publish@release/v1
You can’t perform that action at this time.
0 commit comments