Skip to content

Commit 2d304ef

Browse files
committed
Add GitHub workflow
1 parent a589500 commit 2d304ef

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# This workflow will upload a Python Package to PyPI when a release is published
2+
# For more information see:
3+
# - https://packaging.python.org/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
4+
# - https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
5+
6+
name: Upload Python Package
7+
8+
on:
9+
push
10+
11+
jobs:
12+
build-n-publish:
13+
name: Build and publish to PyPI
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
- name: Set up Python
19+
uses: actions/setup-python@v2
20+
with:
21+
python-version: "3.x"
22+
- name: Install pypa/build
23+
run: |
24+
python -m pip install --upgrade pip
25+
pip install --upgrade build
26+
- name: Build package
27+
run: |
28+
python -m build
29+
- name: Publish package to Test PyPI
30+
uses: pypa/gh-action-pypi-publish@release/v1.4.2
31+
with:
32+
user: __token__
33+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
34+
- name: Publish package to PyPI
35+
if: startsWith(github.ref, "refs/tags")
36+
uses: pypa/gh-action-pypi-publish@release/v1.4.2
37+
with:
38+
user: __token__
39+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)