Skip to content

Commit f58b76f

Browse files
committed
Move release job to separate workflow
1 parent a7ea68b commit f58b76f

File tree

2 files changed

+43
-33
lines changed

2 files changed

+43
-33
lines changed

Diff for: .github/workflows/ci.yaml

+9-33
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,29 @@ name: CI
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: ["main"]
6+
67
pull_request:
7-
branches: [ "main" ]
8+
branches: ["main"]
89

910
jobs:
1011
test:
11-
name: "Test Python ${{ matrix.python-version }}"
1212
runs-on: ubuntu-20.04
13+
14+
name: "Test Python ${{ matrix.python-version }}"
15+
1316
strategy:
1417
fail-fast: false
1518
matrix:
1619
python-version: ["3.8", "3.9", "3.10", "3.11"]
20+
1721
defaults:
1822
run:
1923
shell: bash
24+
2025
steps:
2126
- uses: actions/checkout@v3
22-
- name: Setup Python
23-
uses: actions/setup-python@v3
27+
- uses: actions/setup-python@v3
2428
with:
2529
python-version: ${{ matrix.python-version }}
2630
cache: "pip"
@@ -36,31 +40,3 @@ jobs:
3640
python -m black --check .
3741
- name: Test
3842
run: python -m pytest
39-
40-
release:
41-
name: "Release"
42-
runs-on: ubuntu-20.04
43-
steps:
44-
- uses: actions/checkout@master
45-
- name: Setup Python
46-
uses: actions/setup-python@v2
47-
with:
48-
python-version: "3.10"
49-
- name: Install pypa/build
50-
run: >-
51-
python -m
52-
pip install
53-
build
54-
--user
55-
- name: Build a package
56-
run: >-
57-
python -m
58-
build
59-
--sdist
60-
--outdir dist/
61-
.
62-
- name: Publish distribution 📦 to PyPI
63-
if: startsWith(github.ref, 'refs/tags')
64-
uses: pypa/gh-action-pypi-publish@master
65-
with:
66-
password: ${{ secrets.PYPI_API_TOKEN }}

Diff for: .github/workflows/release.yaml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["*"]
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-20.04
10+
11+
name: "Publish to PyPI"
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-python@v3
16+
with:
17+
python-version: "3.10"
18+
- name: Install pypa/build
19+
run: >-
20+
python -m
21+
pip install
22+
build
23+
--user
24+
- name: Build a package
25+
run: >-
26+
python -m
27+
build
28+
--sdist
29+
--outdir dist/
30+
.
31+
- name: Publish distribution 📦 to PyPI
32+
uses: pypa/gh-action-pypi-publish@master
33+
with:
34+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)