11name : Upload Python Package
2-
32on :
43 push :
54 branches :
6- - master
7-
5+ - main
86permissions :
97 contents : write
108 id-token : write
119 actions : write
1210 packages : write
13-
1411jobs :
1512 release :
1613 runs-on : ubuntu-latest
1714 steps :
18- - name : Checkout master branch
19- uses : actions/checkout@v4
20- with :
21- ref : master
22- fetch-depth : 0
23-
24- - name : Create and push to release-main
25- run : |
26- git checkout -b release-main
27- git push origin release-main
28-
29- - name : Checkout release branch
30- run : git checkout release-main
31-
32- - name : Set up Python
33- uses : actions/setup-python@v3
34- with :
35- python-version : ' 3.x'
36-
37- - name : Install dependencies
38- run : |
39- python -m pip install --upgrade pip
40- pip install build twine python-semantic-release setuptools-scm
41-
42- - name : Run semantic-release
43- env :
44- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
45- run : |
46- git config user.name github-actions
47- git config user.email github-actions@github.com
48- semantic-release version
49- semantic-release publish
50-
51- - name : Build package
52- run : python -m build
53-
54- - name : Publish package to PyPI
55- env :
56- TWINE_USERNAME : __token__
57- TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
58- run : twine upload dist/*
59-
60- - name : Raise PR from release-main to master
61- uses : peter-evans/create-pull-request@v5
62- with :
63- base : master
64- head : release-main
65- title : ' Release PR: release-main -> master'
66- body : ' This PR merges the changes from the release-main branch back into master after the release.'
67- branch : pr-release-main-to-master
15+ - name : Checkout main branch
16+ uses : actions/checkout@v4
17+ with :
18+ fetch-depth : 0
19+ - name : Set up Python
20+ uses : actions/setup-python@v3
21+ with :
22+ python-version : " 3.x"
23+ - name : Install dependencies
24+ run : |
25+ python -m pip install --upgrade pip
26+ pip install build twine python-semantic-release setuptools-scm
27+ - name : Run semantic-release
28+ env :
29+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
30+ run : |
31+ git config user.name github-actions
32+ git config user.email github-actions@github.com
33+ semantic-release version
34+ semantic-release publish
35+ - name : Build package
36+ run : python -m build
37+ - name : Publish package to PyPI
38+ env :
39+ TWINE_USERNAME : __token__
40+ TWINE_PASSWORD : ${{ secrets.PYPI_API_TOKEN }}
41+ run : twine upload dist/*
0 commit comments