1- name : Publish Python distribution to PyPI
1+ name : Publish Python Distribution to PyPI
22
33on :
44 push :
77
88jobs :
99 build :
10- name : Build distribution 📦
10+ name : Build Python Distribution 📦
1111 runs-on : ubuntu-latest
12+
1213 steps :
13- - uses : actions/checkout@v4
14+ - name : Checkout code
15+ uses : actions/checkout@v4
16+
1417 - name : Set up Python
1518 uses : actions/setup-python@v5
1619 with :
17- python-version : " 3.x"
18- - name : Install build tools
20+ python-version : " 3.x" # Use the latest stable Python 3 version
21+
22+ - name : Upgrade pip and install build tools
1923 run : |
2024 python -m pip install --upgrade pip
21- pip install build
25+ pip install build wheel setuptools
26+
2227 - name : Build package
2328 run : python -m build
24- - name : Store distribution packages
29+
30+ - name : Upload built distributions
2531 uses : actions/upload-artifact@v4
2632 with :
2733 name : python-package-distributions
2834 path : dist/
2935
3036 publish-to-pypi :
31- name : Publish to PyPI
32- needs :
33- - build
37+ name : Publish to PyPI 🚀
38+ needs : build
3439 runs-on : ubuntu-latest
35- environment :
36- name : pypi
37- url : https://pypi.org/p/optimrl
38- permissions :
39- id-token : write
40-
4140 steps :
42- - name : Download built packages
41+ - name : Download built distributions
4342 uses : actions/download-artifact@v4
4443 with :
4544 name : python-package-distributions
4645 path : dist/
46+
4747 - name : Publish to PyPI
4848 uses : pypa/gh-action-pypi-publish@release/v1
49+ with :
50+ password : ${{ secrets.PYPI_API_TOKEN }}
4951
5052 github-release :
51- name : Create GitHub Release
52- needs :
53- - publish-to-pypi
53+ name : Create GitHub Release 🏷️
54+ needs : publish-to-pypi
5455 runs-on : ubuntu-latest
55- permissions :
56- contents : write
57- id-token : write
58-
5956 steps :
60- - name : Download packages
57+ - name : Download built distributions
6158 uses : actions/download-artifact@v4
6259 with :
6360 name : python-package-distributions
6461 path : dist/
65- - name : Sign with Sigstore
66- 62+
63+ - name : Create GitHub Release
64+ uses : softprops/action-gh-release@v1
6765 with :
68- inputs : >-
69- ./dist/*.tar.gz
70- ./dist/*.whl
71- - name : Create Release
72- env :
73- GITHUB_TOKEN : ${{ github.token }}
74- run : >-
75- gh release create
76- "$GITHUB_REF_NAME"
77- --repo "$GITHUB_REPOSITORY"
78- --notes ""
79- - name : Upload assets
66+ files : dist/*
8067 env :
81- GITHUB_TOKEN : ${{ github.token }}
82- run : >-
83- gh release upload
84- "$GITHUB_REF_NAME" dist/**
85- --repo "$GITHUB_REPOSITORY"
68+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments