File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,22 +2,48 @@ name: Release
22
33on :
44 push :
5- tags :
6- - ' v* '
5+ branches :
6+ - main
77
88permissions :
9- contents : read
9+ contents : write
1010 packages : write
1111
1212jobs :
13+ release :
14+ runs-on : ubuntu-latest
15+ concurrency :
16+ group : release
17+ cancel-in-progress : false
18+
19+ outputs :
20+ released : ${{ steps.release.outputs.released }}
21+ version : ${{ steps.release.outputs.version }}
22+ tag : ${{ steps.release.outputs.tag }}
23+
24+ steps :
25+ - name : Checkout
26+ uses : actions/checkout@v4
27+ with :
28+ fetch-depth : 0
29+ ref : ${{ github.ref_name }}
30+
31+ - name : Python Semantic Release
32+ id : release
33+ uses : python-semantic-release/python-semantic-release@v9.15.2
34+ with :
35+ github_token : ${{ secrets.GITHUB_TOKEN }}
36+
1337 docker :
38+ needs : release
39+ if : needs.release.outputs.released == 'true'
1440 runs-on : ubuntu-latest
1541
1642 steps :
1743 - name : Checkout
1844 uses : actions/checkout@v4
1945 with :
20- ref : ${{ github.ref }}
46+ ref : ${{ needs.release.outputs.tag }}
2147
2248 - name : Set up Docker Buildx
2349 uses : docker/setup-buildx-action@v3
3561 with :
3662 images : ghcr.io/${{ github.repository }}
3763 tags : |
38- type=semver,pattern={{version}}
39- type=semver,pattern={{major}}.{{minor}}
64+ type=semver,pattern={{version}},value=${{ needs.release.outputs.version }}
65+ type=semver,pattern={{major}}.{{minor}},value=${{ needs.release.outputs.version }}
4066 type=raw,value=latest
4167
4268 - name : Build and push
Original file line number Diff line number Diff line change @@ -120,3 +120,19 @@ exclude_lines = [
120120 " if TYPE_CHECKING:" ,
121121]
122122
123+ # Semantic Release configuration
124+ [tool .semantic_release ]
125+ version_toml = [" pyproject.toml:project.version" ]
126+ tag_format = " v{version}"
127+ commit_parser = " conventional"
128+ allow_zero_version = true
129+ major_on_zero = false
130+
131+ [tool .semantic_release .branches .main ]
132+ match = " main"
133+ prerelease = false
134+
135+ [tool .semantic_release .commit_author ]
136+ env = " GIT_COMMIT_AUTHOR"
137+ default = " github-actions <actions@github.com>"
138+
You can’t perform that action at this time.
0 commit comments