1
1
name : Release
2
2
3
3
on :
4
- release :
5
- types : [published]
4
+ push :
5
+ branches :
6
+ - master
6
7
7
8
jobs :
8
9
release :
10
+ name : Release
9
11
runs-on : ubuntu-latest
10
12
steps :
11
13
- name : Check out the repository
12
-
14
+
15
+ with :
16
+ fetch-depth : 2
13
17
14
18
- name : Set up Python
15
19
uses : actions/setup-python@v2
@@ -26,17 +30,43 @@ jobs:
26
30
pip install --constraint=.github/workflows/constraints.txt poetry
27
31
poetry --version
28
32
29
- - name : Install Nox
30
- run : |
31
- pip install --constraint=.github/workflows/constraints.txt nox
32
- nox --version
33
+ - name : Detect and tag new version
34
+ id : check-version
35
+
36
+ with :
37
+ version-command : |
38
+ poetry version | awk '{ print $2 }'
33
39
34
- - name : Run Nox
35
- run : nox --force-color
40
+ - name : Bump version for developmental release
41
+ if : " ! steps.check-version.outputs.tag"
42
+ run : |
43
+ poetry version patch &&
44
+ version=$(poetry version | awk '{ print $2 }') &&
45
+ poetry version $version.dev.$(date +%s)
36
46
37
- - run : poetry build --ansi
47
+ - name : Build package
48
+ run : |
49
+ poetry build --ansi
38
50
39
-
51
+ - name : Publish package on PyPI
52
+ if : steps.check-version.outputs.tag
53
+
40
54
with :
41
55
user : __token__
42
56
password : ${{ secrets.PYPI_TOKEN }}
57
+
58
+ - name : Publish package on TestPyPI
59
+ if : " ! steps.check-version.outputs.tag"
60
+
61
+ with :
62
+ user : __token__
63
+ password : ${{ secrets.TEST_PYPI_TOKEN }}
64
+ repository_url : https://test.pypi.org/legacy/
65
+
66
+ - name : Publish the release notes
67
+ uses :
release-drafter/[email protected]
68
+ with :
69
+ publish : ${{ steps.check-version.outputs.tag != '' }}
70
+ tag : ${{ steps.check-version.outputs.tag }}
71
+ env :
72
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments