Skip to content

Commit 1e77eba

Browse files
committed
use github actions to release on pypi
1 parent cf14591 commit 1e77eba

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish tagged releases to PyPI and TestPyPI
2+
3+
on:
4+
release:
5+
types:
6+
- created
7+
8+
jobs:
9+
build-n-publish:
10+
name: Build and publish Python distributions to PyPI and TestPyPI
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v1
14+
- name: Set up Python
15+
uses: actions/setup-python@v1
16+
with:
17+
python-version: "3.9"
18+
19+
- name: Install pypa/build
20+
run: >-
21+
python -m
22+
pip install
23+
build
24+
--user
25+
- name: Build a binary wheel and a source tarball
26+
run: >-
27+
python -m
28+
build
29+
--sdist
30+
--wheel
31+
--outdir dist/
32+
33+
- name: Publish distribution to Test PyPI
34+
uses: pypa/gh-action-pypi-publish@release/v1
35+
with:
36+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
37+
repository_url: https://test.pypi.org/legacy/
38+
39+
- name: Publish distribution to PyPI
40+
if: startsWith(github.ref, 'refs/tags')
41+
uses: pypa/gh-action-pypi-publish@release/v1
42+
with:
43+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)