99 workflow_dispatch :
1010
1111jobs :
12+ lint :
13+ name : Run linters
14+ runs-on : ubuntu-latest
15+ outputs :
16+ version : ${{ steps.version.outputs.version }}
17+ prerelease : ${{ steps.version.outputs.prerelease }}
18+ steps :
19+ - uses : actions/checkout@v2
20+ with :
21+ fetch-depth : 0
22+ - uses : actions/setup-python@v2
23+ with :
24+ python-version : ' 3.9'
25+ - name : Install GitHub matcher for ActionLint checker
26+ run : |
27+ echo "::add-matcher::.github/actionlint-matcher.json"
28+ - name : Install check-wheel-content, and twine
29+ run : python -m pip install build check-wheel-contents tox twine
30+ - name : Build package
31+ run : python -m build
32+ - name : Run tox for linter
33+ run : python -m tox -e lint
34+ - name : List result
35+ run : ls -l dist
36+ - name : Check wheel contents
37+ run : check-wheel-contents dist/*.whl
38+ - name : Check long_description
39+ run : python -m twine check dist/*
40+ - name : Get version info
41+ id : version
42+ run : tox -e version-info
43+ - name : Upload artifacts
44+ uses : actions/upload-artifact@v2
45+ with :
46+ name : dist
47+ path : dist
48+
1249 test :
1350 name : Python ${{ matrix.python-version }}
1451 runs-on : ubuntu-latest
2158
2259 steps :
2360 - uses : actions/checkout@v2
61+ with :
62+ fetch-depth : 0
2463 - uses : actions/setup-python@v2
2564 with :
2665 python-version : ${{ matrix.python-version }}
4180 check :
4281 name : Check
4382 if : always()
44- needs : [test]
83+ needs : [lint, test]
4584 runs-on : ubuntu-latest
4685 steps :
4786 - name : Decide whether the needed jobs succeeded or failed
@@ -51,23 +90,36 @@ jobs:
5190 - name : Upload coverage
5291 uses : aio-libs/upload-coverage@v21.9.4
5392
54- package :
55- name : Build & verify package
93+ deploy :
94+ name : Deploy
95+ environment : release
96+ # Run only on pushing a tag
97+ if : github.event_name == 'push' && contains(github.ref, 'refs/tags/')
98+ needs : [lint, check]
5699 runs-on : ubuntu-latest
57-
58100 steps :
59- - uses : actions/checkout@v2
60- - uses : actions/setup-python @v2
101+ - name : Checkout
102+ uses : actions/checkout @v2.4.0
61103 with :
62- python-version : ' 3.9'
63-
64- - name : Install poetry, check-wheel-content, and twine
65- run : python -m pip install build check-wheel-contents twine
66- - name : Build package
67- run : python -m build
68- - name : List result
69- run : ls -l dist
70- - name : Check wheel contents
71- run : check-wheel-contents dist/*.whl
72- - name : Check long_description
73- run : python -m twine check dist/*
104+ fetch-depth : 0
105+ - name : Download distributions
106+ uses : actions/download-artifact@v2
107+ with :
108+ name : dist
109+ path : dist
110+ - name : Collected dists
111+ run : |
112+ tree dist
113+ - name : PyPI upload
114+ uses : pypa/gh-action-pypi-publish@v1.4.2
115+ with :
116+ packages_dir : dist
117+ password : ${{ secrets.PYPI_API_TOKEN }}
118+ - name : GitHub Release
119+ uses : ncipollo/release-action@v1
120+ with :
121+ name : pytest-asyncio ${{ needs.lint.outputs.version }}
122+ artifacts : dist
123+ bodyFile : README.rst
124+ prerelease : ${{ needs.lint.outputs.prerelease }}
125+ token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments