13
13
# See the License for the specific language governing permissions and
14
14
# limitations under the License.
15
15
16
+ version : 2.1
16
17
name : Deploy to PyPI
17
18
18
19
on :
28
29
PYTHON_VERSION : " 3.10"
29
30
POETRY_VERSION : " 1.1.11"
30
31
32
+
31
33
jobs :
32
34
release :
33
35
# https://github.community/t/how-do-i-specify-job-dependency-running-in-another-workflow/16482
@@ -45,54 +47,34 @@ jobs:
45
47
uses : actions/checkout@v3
46
48
with :
47
49
fetch-depth : 0 # action `relekang/python-semantic-release` requires all git history
50
+
48
51
- name : Setup python ${{ env.PYTHON_VERSION }}
49
52
# see https://github.com/actions/setup-python
50
53
uses : actions/setup-python@v4
51
54
with :
52
55
python-version : ${{ env.PYTHON_VERSION }}
53
- - name : Setup poetry ${{ env.POETRY_VERSION }}
54
- # see https://github.com/marketplace/actions/setup-poetry
55
- uses : Gr1N/setup-poetry@v7
56
+
57
+ - name : Install and configure Poetry
58
+ # See https://github.com/marketplace/actions/install-poetry-action
59
+ uses : snok/install-poetry@v1
56
60
with :
57
- poetry-version : ${{ env.POETRY_VERSION }}
58
- - name : pre-hook
59
- id : before-release
60
- run : |
61
- VERSION="$(poetry version --short --no-interaction --no-ansi)"
62
- # version may be empty at first
63
- echo "::set-output name=version::$VERSION"
61
+ version : ${{ env.POETRY_VERSION }}
62
+ virtualenvs-create : true
63
+ virtualenvs-in-project : true
64
+ installer-parallel : true
65
+
66
+ - name : Install dependencies
67
+ run : poetry install --no-root
68
+
69
+ - name : View poetry version
70
+ run : poetry --version
71
+
64
72
- name : Python Semantic Release
65
- id : semantic-release
66
73
# see https://python-semantic-release.readthedocs.io/en/latest/automatic-releases/github-actions.html
67
74
# see https://github.com/relekang/python-semantic-release
68
- uses : relekang/python-semantic-release@v7.29.5
75
+ uses : relekang/python-semantic-release@v7.31.2
69
76
with :
70
77
github_token : ${{ secrets.GITHUB_TOKEN }}
71
78
repository_username : __token__
72
79
repository_password : ${{ secrets.PYPI_TOKEN }}
73
- pypi_token : ${{ secrets.PYPI_TOKEN }}
74
- - name : post-hook
75
- id : after-release
76
- run : |
77
- VERSION="$(poetry version --short --no-interaction --no-ansi)"
78
- # version may still be empty
79
- echo "::set-output name=version::$VERSION"
80
- if [ "$VERSION" != "$VERSION_PRE" ]
81
- then
82
- echo "::set-output name=released::true"
83
- fi
84
- env :
85
- VERSION_PRE : ${{ steps.before-release.outputs.version }}
86
- - name : Artifact python dist
87
- if : |
88
- !failure() && !cancelled() &&
89
- steps.after-release.outputs.released
90
- # see https://github.com/actions/upload-artifact
91
- uses : actions/upload-artifact@v3
92
- with :
93
- name : ${{ env.DIST_ARTIFACT }}
94
- path : ${{ env.DIST_DIR }}/
95
- if-no-files-found : error
96
- # Dist results are required for further processing.
97
- # Therefore, make sure that python-semantic-release is configuret to keep dist.
98
- # see https://python-semantic-release.readthedocs.io/en/latest/configuration.html?highlight=remove_dist#remove-dist
80
+ pypi_token : ${{ secrets.PYPI_TOKEN }}
0 commit comments