File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed
Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Release to PyPI
2+
3+ # Trigger the workflow on new tag creation
4+ on :
5+ push :
6+ tags :
7+ - ' v*' # Triggers on version tags like v1.0.0, v0.1.1, etc.
8+
9+ permissions :
10+ contents : read
11+
12+ jobs :
13+ build-and-publish :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ # Check out the repository code
18+ - name : Checkout code
19+ uses : actions/checkout@v4
20+
21+ # Set up Python environment
22+ - name : Set up Python
23+ uses : actions/setup-python@v4
24+ with :
25+ python-version : ' 3.12'
26+
27+ # Install build dependencies
28+ - name : Install build dependencies
29+ run : |
30+ python -m pip install --upgrade pip
31+ python -m pip install build twine
32+
33+ # Build wheel and source distributions
34+ - name : Build distributions
35+ run : |
36+ python -m build
37+
38+ # Verify the distributions were created
39+ - name : Verify build artifacts
40+ run : |
41+ ls -la dist/
42+ echo "Built packages:"
43+ ls dist/
44+
45+ # Check the distributions before upload
46+ - name : Check distributions
47+ run : |
48+ python -m twine check dist/*
49+
50+ # Upload to PyPI using twine
51+ - name : Upload to PyPI
52+ env :
53+ TWINE_USERNAME : __token__
54+ TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
55+ run : |
56+ python -m twine upload dist/*
You can’t perform that action at this time.
0 commit comments