Skip to content

Commit c61a1cf

Browse files
authored
Merge pull request #168 from pytest-dev/automatic_publish_on_release
automatic publish on release
2 parents 6bed85b + 663f353 commit c61a1cf

File tree

1 file changed

+51
-1
lines changed

1 file changed

+51
-1
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
pull_request:
1010
branches:
1111
- "*"
12+
release:
13+
types:
14+
- published
1215
schedule:
1316
# Daily at 05:47
1417
- cron: '47 5 * * *'
@@ -21,8 +24,28 @@ env:
2124
PIP_NO_PYTHON_VERSION_WARNING: 1
2225

2326
jobs:
27+
build:
28+
name: Build
29+
runs-on: ubuntu-latest
30+
container: docker://python:3.11-buster
31+
steps:
32+
- uses: actions/checkout@v2
33+
- name: Build
34+
run: |
35+
python -m venv venv
36+
venv/bin/pip install --upgrade pip
37+
venv/bin/pip install build
38+
venv/bin/python -m build --outdir dist/
39+
- uses: actions/upload-artifact@v4
40+
if: always()
41+
with:
42+
name: dist
43+
path: dist/*
44+
if-no-files-found: error
45+
2446
test:
2547
name: ${{ matrix.os.name }} ${{ matrix.python.name }} ${{ matrix.reactor.name }}
48+
needs: build
2649
runs-on: ${{ matrix.os.runs-on }}
2750
container: ${{ matrix.os.container[matrix.python.docker] }}
2851
strategy:
@@ -233,9 +256,15 @@ jobs:
233256
- name: Install
234257
run: |
235258
pip install tox
259+
- uses: actions/download-artifact@v4
260+
with:
261+
name: dist
262+
path: dist/
236263
- name: Test
264+
shell: bash
237265
run: |
238-
tox -v -e "${{ matrix.python.tox }}-${{ matrix.reactor.tox }}reactor"
266+
tox --installpkg dist/*.whl -v -e "${{ matrix.python.tox }}-${{ matrix.reactor.tox }}reactor"
267+
239268
linting:
240269
name: Linting
241270
runs-on: ubuntu-latest
@@ -257,12 +286,33 @@ jobs:
257286
- name: Test
258287
run: |
259288
tox -v -e linting
289+
290+
publish:
291+
name: Publish
292+
runs-on: ubuntu-latest
293+
needs:
294+
- build
295+
- test
296+
- linting
297+
steps:
298+
- uses: actions/download-artifact@v4
299+
with:
300+
name: dist
301+
path: dist/
302+
- uses: pypa/gh-action-pypi-publish@release/v1
303+
if: github.event_name == 'release'
304+
with:
305+
packages-dir: dist/
306+
skip-existing: true
307+
260308
all:
261309
name: All
262310
runs-on: ubuntu-latest
263311
needs:
312+
- build
264313
- test
265314
- linting
315+
- publish
266316
steps:
267317
- name: This
268318
shell: python

0 commit comments

Comments
 (0)