Skip to content

Commit 9bc14a0

Browse files
committed
Automate releases
1 parent afe5cb1 commit 9bc14a0

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

.github/workflows/build.yaml

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ on:
33
push:
44
branches:
55
- main
6+
tags:
7+
- "v*"
68
pull_request:
79
jobs:
810
build-and-test:
@@ -23,10 +25,38 @@ jobs:
2325
with:
2426
python-version: ${{ matrix.python-version }}
2527
- name: Build package
26-
run: python setup.py build
27-
- name: Install package
28-
run: python setup.py install
28+
run: |
29+
python -m pip install --upgrade build twine
30+
python -m build
31+
twine check --strict dist/*
2932
- name: Install coveralls
3033
run: sudo pip install coveralls
3134
- name: Run tests
3235
run: sudo PATH=$PATH coverage run setup.py test
36+
37+
release:
38+
runs-on: ubuntu-latest
39+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
40+
needs:
41+
- build-and-test (3.7)
42+
- build-and-test (3.8)
43+
- build-and-test (3.9)
44+
- build-and-test (3.10)
45+
- build-and-test (3.11)
46+
steps:
47+
- name: Check out code
48+
uses: actions/checkout@v2
49+
- name: Set up Python
50+
uses: actions/setup-python@v2
51+
with:
52+
python-version: "3.x"
53+
- name: Build package
54+
run: |
55+
python -m pip install --upgrade build twine
56+
python -m build
57+
twine check --strict dist/*
58+
- name: Publish package
59+
uses: pypa/gh-action-pypi-publish@release/v1
60+
with:
61+
user: __token__
62+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)