11name : Release
22
33on :
4- release :
5- types : [published]
4+ push :
5+ branches :
6+ - master
67
78jobs :
89 release :
10+ name : Release
911 runs-on : ubuntu-latest
1012 steps :
1113 - name : Check out the repository
12- uses : actions/checkout@v2.1.0
14+ uses : actions/checkout@v2.1.1
15+ with :
16+ fetch-depth : 2
1317
1418 - name : Set up Python
1519 uses : actions/setup-python@v2
@@ -26,17 +30,43 @@ jobs:
2630 pip install --constraint=.github/workflows/constraints.txt poetry
2731 poetry --version
2832
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+ uses : salsify/action-detect-and-tag-new-version@v1.0.3
36+ with :
37+ version-command : |
38+ poetry version | awk '{ print $2 }'
3339
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)
3646
37- - run : poetry build --ansi
47+ - name : Build package
48+ run : |
49+ poetry build --ansi
3850
39- - uses : pypa/gh-action-pypi-publish@v1.1.0
51+ - name : Publish package on PyPI
52+ if : steps.check-version.outputs.tag
53+ uses : pypa/gh-action-pypi-publish@v1.1.0
4054 with :
4155 user : __token__
4256 password : ${{ secrets.PYPI_TOKEN }}
57+
58+ - name : Publish package on TestPyPI
59+ if : " ! steps.check-version.outputs.tag"
60+ uses : pypa/gh-action-pypi-publish@v1.1.0
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/release-drafter@v5.8.0
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