-
-
Notifications
You must be signed in to change notification settings - Fork 23
45 lines (45 loc) · 1.29 KB
/
build-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
41
42
43
44
45
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
on:
push:
pull_request:
release:
types: [published]
jobs:
build-and-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install tox
run: >-
pip install tox
- name: Pre Commit
run: >-
tox -e pre-commit
- name: Test
run: >-
tox
- name: Build
run: >-
tox -e build
- name: Publish distribution 📦 to Test PyPI
if: contains(github.ref, 'refs/heads/master')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.test_pypi_password }}
TWINE_REPOSITORY_URL: https://test.pypi.org/legacy/
run: >-
tox -e publish
- name: Publish distribution 📦 to PyPI
if: contains(github.ref, 'refs/tags/v')
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_password }}
TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/
run: >-
tox -e publish -- --repository pypi