-
Notifications
You must be signed in to change notification settings - Fork 37
66 lines (63 loc) · 1.99 KB
/
build.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Build
on: [push, pull_request]
jobs:
tox:
strategy:
matrix:
os:
- 'ubuntu-latest'
python-version:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
# Need full history to determine version number.
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Python packaging/test tools
run: python -m pip install tox wheel
- name: Show package version
run: python setup.py --version
- name: Test with tox
run: tox
- name: Build wheel
run: python setup.py bdist_wheel
- name: Upload wheels as artifacts
uses: actions/upload-artifact@v4
if: ${{ runner.os == 'Linux' && matrix.python-version == '3.9' }}
with:
name: python-packages
path: |
dist/*.whl
dist/*.tar.gz
python-publish-package:
# Only publish package on push to tag or default branch.
if: ${{ github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master') }}
runs-on: ubuntu-latest
needs:
- tox
steps:
- uses: actions/download-artifact@v4.1.7
with:
name: python-packages
path: dist
- name: Publish to PyPI (test server)
uses: pypa/gh-action-pypi-publish@54b39fb9371c0b3a6f9f14bb8a67394defc7a806 # 2020-09-25
with:
user: __token__
password: ${{ secrets.pypi_test_token }}
repository_url: https://test.pypi.org/legacy/
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
- name: Publish to PyPI (main server)
uses: pypa/gh-action-pypi-publish@54b39fb9371c0b3a6f9f14bb8a67394defc7a806 # 2020-09-25
with:
user: __token__
password: ${{ secrets.pypi_token }}
if: ${{ startsWith(github.ref, 'refs/tags/v') }}