Skip to content

Commit b183863

Browse files
authored
add build and push to pypi in ci workflow (#241)
* add build and push to pypi in ci workflow * install wheel package * run jobs sequentially * remove test publish to test.pypi.org/legacy
1 parent 9dbca09 commit b183863

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI tests
1+
name: Run tests and build package
22
on:
33
pull_request:
44
push:
@@ -31,11 +31,12 @@ jobs:
3131
3232
tests:
3333
name: Run tests
34+
needs: linting
3435
runs-on: ubuntu-latest
3536

3637
strategy:
3738
fail-fast: false
38-
max-parallel: 4
39+
max-parallel: 5
3940
matrix:
4041
python-version: [3.7, 3.8, 3.9, 3.10, 3.11]
4142

@@ -62,3 +63,27 @@ jobs:
6263
run: coveralls --service=github
6364
env:
6465
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
67+
build-and-push:
68+
name: Build and publish package to PyPI
69+
needs: [linting, tests]
70+
runs-on: ubuntu-latest
71+
72+
steps:
73+
- uses: actions/checkout@master
74+
75+
- name: Set up Python 3.10
76+
uses: actions/setup-python@v3
77+
with:
78+
python-version: "3.10"
79+
80+
- name: Build a binary wheel and a source tarball
81+
run: |
82+
python3 -m pip install wheel
83+
python3 setup.py sdist bdist_wheel
84+
85+
- name: Publish distribution to PyPI (if tagged)
86+
if: startsWith(github.ref, 'refs/tags')
87+
uses: pypa/gh-action-pypi-publish@release/v1
88+
with:
89+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)