-
Notifications
You must be signed in to change notification settings - Fork 9
53 lines (43 loc) · 1.22 KB
/
publish.yaml
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
46
47
48
49
50
51
52
53
name: Build package / publish
on:
push:
branches: [ main ]
tags: [ "v*" ]
release:
types: [ published ]
# Check that package can be built even on PRs
pull_request:
branches: [ main ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: actions/setup-python@v2
- name: Cache Python packages
uses: actions/cache@v2
with:
path: |
~/.cache/pip
key: publish-${{ runner.os }}
- name: Upgrade pip, wheel, setuptools-scm
run: python -m pip install --upgrade pip wheel setuptools-scm twine
- name: Build package
run: |
python3 setup.py bdist_wheel sdist
twine check dist/*
- name: Publish to TestPyPI
uses: pypa/[email protected]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
user: __token__
password: ${{ secrets.TESTPYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish to PyPI
uses: pypa/[email protected]
if: github.event_name == 'release'
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}