-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (35 loc) · 1.15 KB
/
build_and_publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Build and Publish Python distributions to TestPyPI and PyPI
on: push
jobs:
build-n-publish:
name: Build and Publish Python distributions to TestPyPI and PyPI
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@master
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install build twine
- name: Build package
run: python3 -m build
- name: Upload to TestPyPI
run: python3 -m twine upload --repository-url https://test.pypi.org/legacy/ --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
- name: Upload to PyPI
if: startsWith(github.ref, 'refs/tags')
run: python3 -m twine upload --skip-existing dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}