|
6 | 6 | # separate terms of service, privacy policy, and support |
7 | 7 | # documentation. |
8 | 8 |
|
9 | | -name: Upload Python Package |
| 9 | +name: Build and upload to PyPI |
10 | 10 |
|
11 | 11 | on: |
12 | | - release: |
13 | | - types: [published] |
14 | 12 | push: |
15 | 13 | branches: [ master ] |
16 | | - # Publish semver tags as releases. |
17 | | - tags: [ 'v*.*.*' ] |
18 | 14 | pull_request: |
19 | 15 | branches: [ master ] |
20 | | - |
21 | 16 | workflow_dispatch: |
22 | 17 |
|
23 | 18 | jobs: |
24 | | - deploy: |
| 19 | + build_wheels: |
| 20 | + name: Build wheels manylinux |
| 21 | + runs-on: ubuntu-latest |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - name: Build wheels |
| 26 | + |
| 27 | + env: |
| 28 | + CIBW_REPAIR_WHEEL_COMMAND_LINUX: "" |
| 29 | + CIBW_SKIP: "*-musllinux_*" |
| 30 | + CIBW_BEFORE_BUILD_LINUX: yum install -y openssl-devel libuuid-devel json-c-devel |
| 31 | + CIBW_BUILD_VERBOSITY: 1 |
| 32 | + |
| 33 | + - uses: actions/upload-artifact@v2 |
| 34 | + with: |
| 35 | + path: ./wheelhouse/*.whl |
| 36 | + retention-days: 5 |
25 | 37 |
|
| 38 | + build_sdist: |
| 39 | + name: Build source distribution |
26 | 40 | runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v2 |
| 43 | + |
| 44 | + - name: Build sdist |
| 45 | + run: pipx run build --sdist |
| 46 | + |
| 47 | + - uses: actions/upload-artifact@v2 |
| 48 | + with: |
| 49 | + path: dist/*.tar.gz |
| 50 | + retention-days: 5 |
27 | 51 |
|
| 52 | + upload_pypi: |
| 53 | + needs: [build_wheels, build_sdist] |
| 54 | + runs-on: ubuntu-latest |
| 55 | + if: github.event_name == 'release' && github.event.action == 'published' |
28 | 56 | steps: |
29 | | - - uses: actions/checkout@v2 |
30 | | - - name: Set up Python |
31 | | - uses: actions/setup-python@v2 |
32 | | - with: |
33 | | - python-version: '3.x' |
34 | | - - name: Install dependencies |
35 | | - run: | |
36 | | - sudo apt-get install libjson-c-dev meson |
37 | | - python -m pip install --upgrade pip |
38 | | - pip install build |
39 | | - - name: Build package |
40 | | - run: python -m build --sdist |
41 | | - - name: Publish package to TestPyPI |
42 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
43 | | - with: |
44 | | - user: __token__ |
45 | | - password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
46 | | - repository_url: https://test.pypi.org/legacy/ |
47 | | - # - name: Publish package to PyPI |
48 | | - # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') |
49 | | - # uses: pypa/gh-action-pypi-publish@release/v1 |
50 | | - # with: |
51 | | - # user: __token__ |
52 | | - # password: ${{ secrets.PYPI_API_TOKEN }} |
| 57 | + - uses: actions/download-artifact@v2 |
| 58 | + with: |
| 59 | + name: artifact |
| 60 | + path: dist |
| 61 | + |
| 62 | + - name: Publish package to TestPyPI |
| 63 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 64 | + with: |
| 65 | + user: __token__ |
| 66 | + password: ${{ secrets.TEST_PYPI_API_TOKEN }} |
| 67 | + repository_url: https://test.pypi.org/legacy/ |
0 commit comments