1+ name : Test and Release
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+
7+ jobs :
8+ Unit_Test :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - uses : actions/checkout@v3
12+ - name : Setup Poetry
13+ uses : abatilo/actions-poetry@v2
14+ with :
15+ poetry-version : 1.8.4
16+ - name : Setup Python
17+ uses : actions/setup-python@v4
18+ with :
19+ python-version : 3.13
20+ cache : " poetry"
21+ - name : Install Dependencies
22+ run : poetry install
23+ - name : Test with PyTest
24+ run : poetry run pytest
25+
26+ Release :
27+ runs-on : ubuntu-latest
28+ needs :
29+ - Unit_Test
30+ steps :
31+ - uses : actions/checkout@v3
32+ with :
33+ token : ${{ secrets.GH_TOKEN }}
34+ - name : Setup Poetry
35+ uses : abatilo/actions-poetry@v2
36+ with :
37+ poetry-version : 1.8.4
38+ - name : Setup Python
39+ uses : actions/setup-python@v4
40+ with :
41+ python-version : 3.13
42+ cache : " poetry"
43+ - name : Get Next Version
44+ id : semver
45+ uses : ietf-tools/semver-action@v1
46+ with :
47+ branch : main
48+ patchList : fix,bugfix,security
49+ noVersionBumpBehavior : silent
50+ token : ${{ secrets.GH_TOKEN }}
51+ - name : Bump Poetry Version
52+ run : poetry version ${{ steps.semver.outputs.nextStrict }}
53+ - name : Commit Release to repo
54+ uses : stefanzweifel/git-auto-commit-action@v4
55+ with :
56+ commit_message : |
57+ Create ${{ steps.semver.outputs.next }} Release
58+
59+ [skip ci]
60+ tagging_message : ${{ steps.semver.outputs.next }}
61+ - name : Create Release
62+ uses : ncipollo/release-action@v1
63+ if : ${{ steps.semver.outputs.next != null }}
64+ with :
65+ name : ${{ steps.semver.outputs.next }}
66+ body : Changelog Contents
67+ tag : ${{ steps.semver.outputs.next }}
68+ token : ${{ github.token }}
69+ makeLatest : true
70+ generateReleaseNotes : true
71+ skipIfReleaseExists : true
72+ - name : Build Library
73+ if : ${{ steps.semver.outputs.next != null }}
74+ run : poetry build
75+ - name : Publish Library
76+ if : ${{ steps.semver.outputs.next != null }}
77+ run : poetry publish
0 commit comments