1
1
name : Publish
2
2
on :
3
- release :
4
- types : [published]
5
- workflow_dispatch :
3
+ push :
4
+ branches : [ "main" ]
6
5
permissions :
7
6
contents : write
8
7
jobs :
18
17
uses : ./.github/workflows/docs.yml
19
18
with :
20
19
test-run-id : ${{ github.run_id }}
21
- deploy :
22
- needs : [quality, test]
23
- name : Deployment
20
+ release :
21
+ needs : [test, quality, documentation]
22
+ name : Release
23
+ if : github.ref == 'refs/heads/main'
24
24
runs-on : ubuntu-latest
25
25
steps :
26
26
- uses : actions/checkout@v4
@@ -31,13 +31,27 @@ jobs:
31
31
with :
32
32
python-version : " 3.11"
33
33
cache : ' poetry'
34
- - name : Install dependencies
35
- run : poetry install --with dev
36
- - name : Publish with Poetry
34
+ - name : Compare tag and version
35
+ run : |
36
+ if [ "$(git tag)" = "$(poetry version --short)" ]; then
37
+ echo "The tag and the version are the same, nothing to do."
38
+ echo "DORELEASE=false" >> $GITHUB_ENV
39
+ else
40
+ echo "DORELEASE=true" >> $GITHUB_ENV
41
+ fi
42
+ - name : Create Release & Tag
43
+ if : env.DORELEASE == 'true'
37
44
run : |
38
- poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
39
- poetry build
40
- poetry publish
41
-
42
-
43
-
45
+ gh release create "$(poetry version --short)" \
46
+ --repo="$GITHUB_REPOSITORY" \
47
+ --title="${GITHUB_REPOSITORY#*/} $(poetry version --short)" \
48
+ --generate-notes
49
+ env :
50
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
51
+ # - name: Publish to PyPI
52
+ # if: env.DORELEASE == 'true'
53
+ # run: |
54
+ # poetry install --with dev
55
+ # poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
56
+ # poetry build
57
+ # poetry publish
0 commit comments