1- name : main
1+ name : tox
22
33on :
44 push :
1515
1616jobs :
1717 build :
18+ name : ${{ matrix.name }}
1819 runs-on : ${{ matrix.os }}
1920
2021 strategy :
2122 fail-fast : false
2223 matrix :
2324 name : [
24- " ubuntu-py27 " ,
25- " ubuntu-py36 " ,
26- " ubuntu-py37 " ,
27- " ubuntu-py38 " ,
25+ " py36 " ,
26+ " py37 " ,
27+ " py38 " ,
28+ " devel " ,
2829 " linting" ,
2930 " packaging" ,
3031 ]
@@ -34,22 +35,18 @@ jobs:
3435
3536 include :
3637
37- - name : " ubuntu-py27"
38- python : " 2.7"
39- os : ubuntu-latest
40- tox_env : " py27"
41- - name : " ubuntu-py36"
38+ - name : py36
4239 python : " 3.6"
4340 os : ubuntu-latest
44- tox_env : " py36"
45- - name : " ubuntu- py37"
41+ tox_env : py36
42+ - name : py37
4643 python : " 3.7"
4744 os : ubuntu-latest
48- tox_env : " py37"
49- - name : " ubuntu- py38"
45+ tox_env : py37
46+ - name : py38
5047 python : " 3.8"
5148 os : ubuntu-latest
52- tox_env : " py38"
49+ tox_env : py38
5350
5451 - name : " linting"
5552 python : " 3.7"
7269 pip install tox
7370 - name : Test
7471 run : " tox -e ${{ matrix.tox_env }}"
72+
73+ publish :
74+ name : Publish to PyPI registry
75+ needs :
76+ - build
77+ runs-on : ubuntu-latest
78+
79+ env :
80+ PY_COLORS : 1
81+ TOXENV : packaging
82+
83+ steps :
84+ - name : Switch to using Python 3.6 by default
85+ uses : actions/setup-python@v2
86+ with :
87+ python-version : 3.6
88+ - name : Install tox
89+ run : python -m pip install --user tox
90+ - name : Check out src from Git
91+ uses : actions/checkout@v2
92+ with :
93+ # Get shallow Git history (default) for tag creation events
94+ # but have a complete clone for any other workflows.
95+ # Both options fetch tags but since we're going to remove
96+ # one from HEAD in non-create-tag workflows, we need full
97+ # history for them.
98+ fetch-depth : >-
99+ ${{
100+ (
101+ github.event_name == 'create' &&
102+ github.event.ref_type == 'tag'
103+ ) &&
104+ 1 || 0
105+ }}
106+ - name : Drop Git tags from HEAD for non-tag-create events
107+ if : >-
108+ github.event_name != 'create' ||
109+ github.event.ref_type != 'tag'
110+ run : >-
111+ git tag --points-at HEAD
112+ |
113+ xargs git tag --delete
114+ - name : Build dists
115+ run : python -m tox
116+ - name : Publish to test.pypi.org
117+ if : >-
118+ (
119+ github.event_name == 'push' &&
120+ github.ref == format(
121+ 'refs/heads/{0}', github.event.repository.default_branch
122+ )
123+ ) ||
124+ (
125+ github.event_name == 'create' &&
126+ github.event.ref_type == 'tag'
127+ )
128+ uses : pypa/gh-action-pypi-publish@master
129+ with :
130+ password : ${{ secrets.testpypi_password }}
131+ repository_url : https://test.pypi.org/legacy/
132+ - name : Publish to pypi.org
133+ if : >- # "create" workflows run separately from "push" & "pull_request"
134+ github.event_name == 'create' &&
135+ github.event.ref_type == 'tag'
136+ uses : pypa/gh-action-pypi-publish@master
137+ with :
138+ password : ${{ secrets.pypi_password }}
0 commit comments