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