@@ -3,15 +3,11 @@ name: tox
33on :
44 push :
55 branches :
6- - master
7- - " [0-9]+.[0-9]+.x"
8- tags :
9- - " *"
6+ - main
107
118 pull_request :
129 branches :
13- - master
14- - " [0-9]+.[0-9]+.x"
10+ - main
1511
1612jobs :
1713 build :
7369 pip install tox
7470 - name : Test
7571 run : " tox -e ${{ matrix.tox_env }}"
76-
77- publish :
78- name : Publish to PyPI registry
79- needs :
80- - build
81- runs-on : ubuntu-latest
82-
83- env :
84- PY_COLORS : 1
85- TOXENV : packaging
86-
87- steps :
88- - name : Switch to using Python 3.6 by default
89- uses : actions/setup-python@v2
90- with :
91- python-version : 3.6
92- - name : Install tox
93- run : python -m pip install --user tox
94- - name : Check out src from Git
95- uses : actions/checkout@v2
96- with :
97- # Get shallow Git history (default) for tag creation events
98- # but have a complete clone for any other workflows.
99- # Both options fetch tags but since we're going to remove
100- # one from HEAD in non-create-tag workflows, we need full
101- # history for them.
102- fetch-depth : >-
103- ${{
104- (
105- github.event_name == 'create' &&
106- github.event.ref_type == 'tag'
107- ) &&
108- 1 || 0
109- }}
110- - name : Drop Git tags from HEAD for non-tag-create events
111- if : >-
112- github.event_name != 'create' ||
113- github.event.ref_type != 'tag'
114- run : >-
115- git tag --points-at HEAD
116- |
117- xargs git tag --delete
118- - name : Build dists
119- run : python -m tox
120- - name : Publish to test.pypi.org
121- if : >-
122- (
123- github.event_name == 'push' &&
124- github.ref == format(
125- 'refs/heads/{0}', github.event.repository.default_branch
126- )
127- ) ||
128- (
129- github.event_name == 'create' &&
130- github.event.ref_type == 'tag'
131- )
132- uses : pypa/gh-action-pypi-publish@master
133- with :
134- password : ${{ secrets.testpypi_password }}
135- repository_url : https://test.pypi.org/legacy/
136- - name : Publish to pypi.org
137- if : >- # "create" workflows run separately from "push" & "pull_request"
138- github.event_name == 'create' &&
139- github.event.ref_type == 'tag'
140- uses : pypa/gh-action-pypi-publish@master
141- with :
142- password : ${{ secrets.pypi_password }}
0 commit comments