Skip to content

Commit 4c16b5a

Browse files
committedMar 19, 2022
Split test/deploy workflows
This will trigger a deploy directly when a tag is pushed, avoiding having to wait for another lenghty build. This is safe since we only push release tags after the release PR has passed all its tests. See comments in #9793.
1 parent eb22339 commit 4c16b5a

File tree

3 files changed

+59
-46
lines changed

3 files changed

+59
-46
lines changed
 

‎.github/workflows/deploy.yml

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: deploy
2+
3+
on:
4+
push:
5+
tags:
6+
# These tags are protected, see:
7+
# https://github.com/pytest-dev/pytest/settings/tag_protection
8+
- "[0-9]+.[0-9]+.[0-9]+"
9+
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
10+
11+
12+
# Set permissions at the job level.
13+
permissions: {}
14+
15+
jobs:
16+
17+
deploy:
18+
if: github.repository == 'pytest-dev/pytest'
19+
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 30
22+
permissions:
23+
contents: write
24+
25+
steps:
26+
- uses: actions/checkout@v2
27+
with:
28+
fetch-depth: 0
29+
persist-credentials: false
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v2
33+
with:
34+
python-version: "3.7"
35+
36+
- name: Install dependencies
37+
run: |
38+
python -m pip install --upgrade pip
39+
pip install --upgrade build tox
40+
41+
- name: Build package
42+
run: |
43+
python -m build
44+
45+
- name: Publish package to PyPI
46+
uses: pypa/gh-action-pypi-publish@master
47+
with:
48+
user: __token__
49+
password: ${{ secrets.pypi_token }}
50+
51+
- name: Publish GitHub release notes
52+
env:
53+
GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
54+
run: |
55+
sudo apt-get install pandoc
56+
tox -e publish-gh-release-notes

‎.github/workflows/main.yml ‎.github/workflows/test.yml

+1-44
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: main
1+
name: test
22

33
on:
44
push:
@@ -187,46 +187,3 @@ jobs:
187187
fail_ci_if_error: true
188188
files: ./coverage.xml
189189
verbose: true
190-
191-
deploy:
192-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') && github.repository == 'pytest-dev/pytest'
193-
194-
runs-on: ubuntu-latest
195-
timeout-minutes: 30
196-
permissions:
197-
contents: write
198-
199-
needs: [build]
200-
201-
steps:
202-
- uses: actions/checkout@v2
203-
with:
204-
fetch-depth: 0
205-
persist-credentials: false
206-
207-
- name: Set up Python
208-
uses: actions/setup-python@v2
209-
with:
210-
python-version: "3.7"
211-
212-
- name: Install dependencies
213-
run: |
214-
python -m pip install --upgrade pip
215-
pip install --upgrade build tox
216-
217-
- name: Build package
218-
run: |
219-
python -m build
220-
221-
- name: Publish package to PyPI
222-
uses: pypa/gh-action-pypi-publish@master
223-
with:
224-
user: __token__
225-
password: ${{ secrets.pypi_token }}
226-
227-
- name: Publish GitHub release notes
228-
env:
229-
GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
230-
run: |
231-
sudo apt-get install pandoc
232-
tox -e publish-gh-release-notes

‎README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
:target: https://codecov.io/gh/pytest-dev/pytest
2121
:alt: Code coverage Status
2222

23-
.. image:: https://github.com/pytest-dev/pytest/workflows/main/badge.svg
24-
:target: https://github.com/pytest-dev/pytest/actions?query=workflow%3Amain
23+
.. image:: https://github.com/pytest-dev/pytest/workflows/test/badge.svg
24+
:target: https://github.com/pytest-dev/pytest/actions?query=workflow%3Atest
2525

2626
.. image:: https://results.pre-commit.ci/badge/github/pytest-dev/pytest/main.svg
2727
:target: https://results.pre-commit.ci/latest/github/pytest-dev/pytest/main

0 commit comments

Comments
 (0)
Please sign in to comment.