Skip to content
This repository was archived by the owner on Jan 6, 2023. It is now read-only.

Commit cf12126

Browse files
authored
Restore release pipeline (#79)
1 parent c2e1515 commit cf12126

File tree

1 file changed

+73
-66
lines changed

1 file changed

+73
-66
lines changed

.github/workflows/tox.yml

+73-66
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ name: tox
33
on:
44
create: # is used for publishing to PyPI and TestPyPI
55
tags: # any tag regardless of its name, no branches
6+
- "**"
67
push: # only publishes pushes to the main branch to TestPyPI
78
branches: # any integration branch but not tag
89
- "master"
9-
tags-ignore:
10-
- "**"
1110
pull_request:
11+
release:
12+
types:
13+
- published # It seems that you can publish directly without creating
1214
schedule:
1315
- cron: 1 0 * * * # Run daily at 0:01 UTC
1416

@@ -66,69 +68,74 @@ jobs:
6668
echo "${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }}"
6769
${{ matrix.PREFIX }} tox -e ${{ matrix.tox_env }}
6870
69-
# publish:
70-
# name: Publish to PyPI registry
71-
# needs:
72-
# - build
73-
# runs-on: ubuntu-latest
71+
publish:
72+
name: Publish to PyPI registry
73+
needs:
74+
- build
75+
runs-on: ubuntu-latest
7476

75-
# env:
76-
# PY_COLORS: 1
77-
# TOXENV: packaging
77+
env:
78+
PY_COLORS: 1
79+
TOXENV: packaging
7880

79-
# steps:
80-
# - name: Switch to using Python 3.6 by default
81-
# uses: actions/setup-python@v2
82-
# with:
83-
# python-version: 3.6
84-
# - name: Install tox
85-
# run: python -m pip install --user tox
86-
# - name: Check out src from Git
87-
# uses: actions/checkout@v2
88-
# with:
89-
# # Get shallow Git history (default) for tag creation events
90-
# # but have a complete clone for any other workflows.
91-
# # Both options fetch tags but since we're going to remove
92-
# # one from HEAD in non-create-tag workflows, we need full
93-
# # history for them.
94-
# fetch-depth: >-
95-
# ${{
96-
# (
97-
# github.event_name == 'create' &&
98-
# github.event.ref_type == 'tag'
99-
# ) &&
100-
# 1 || 0
101-
# }}
102-
# - name: Drop Git tags from HEAD for non-tag-create events
103-
# if: >-
104-
# github.event_name != 'create' ||
105-
# github.event.ref_type != 'tag'
106-
# run: >-
107-
# git tag --points-at HEAD
108-
# |
109-
# xargs git tag --delete
110-
# - name: Build dists
111-
# run: python -m tox
112-
# - name: Publish to test.pypi.org
113-
# if: >-
114-
# (
115-
# github.event_name == 'push' &&
116-
# github.ref == format(
117-
# 'refs/heads/{0}', github.event.repository.default_branch
118-
# )
119-
# ) ||
120-
# (
121-
# github.event_name == 'create' &&
122-
# github.event.ref_type == 'tag'
123-
# )
124-
# uses: pypa/gh-action-pypi-publish@master
125-
# with:
126-
# password: ${{ secrets.testpypi_password }}
127-
# repository_url: https://test.pypi.org/legacy/
128-
# - name: Publish to pypi.org
129-
# if: >- # "create" workflows run separately from "push" & "pull_request"
130-
# github.event_name == 'create' &&
131-
# github.event.ref_type == 'tag'
132-
# uses: pypa/gh-action-pypi-publish@master
133-
# with:
134-
# password: ${{ secrets.pypi_password }}
81+
steps:
82+
- name: Switch to using Python 3.6 by default
83+
uses: actions/setup-python@v2
84+
with:
85+
python-version: 3.6
86+
- name: Install tox
87+
run: python -m pip install --user tox
88+
- name: Check out src from Git
89+
uses: actions/checkout@v2
90+
with:
91+
# Get shallow Git history (default) for release events
92+
# but have a complete clone for any other workflows.
93+
# Both options fetch tags but since we're going to remove
94+
# one from HEAD in non-create-tag workflows, we need full
95+
# history for them.
96+
fetch-depth: >-
97+
${{
98+
(
99+
(
100+
github.event_name == 'create' &&
101+
github.event.ref_type == 'tag'
102+
) ||
103+
github.event_name == 'release'
104+
) &&
105+
1 || 0
106+
}}
107+
- name: Drop Git tags from HEAD for non-tag-create and non-release events
108+
if: >-
109+
(
110+
github.event_name != 'create' ||
111+
github.event.ref_type != 'tag'
112+
) &&
113+
github.event_name != 'release'
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 == 'release'
139+
uses: pypa/gh-action-pypi-publish@master
140+
with:
141+
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)