Skip to content

Commit 9878550

Browse files
authored
Merge pull request #282 from glimchb/wheel2
CI: add python wheel build in addition to source package
2 parents 38a150f + 234a5b6 commit 9878550

1 file changed

Lines changed: 46 additions & 31 deletions

File tree

.github/workflows/python-publish.yml

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,62 @@
66
# separate terms of service, privacy policy, and support
77
# documentation.
88

9-
name: Upload Python Package
9+
name: Build and upload to PyPI
1010

1111
on:
12-
release:
13-
types: [published]
1412
push:
1513
branches: [ master ]
16-
# Publish semver tags as releases.
17-
tags: [ 'v*.*.*' ]
1814
pull_request:
1915
branches: [ master ]
20-
2116
workflow_dispatch:
2217

2318
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+
uses: pypa/[email protected]
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
2537

38+
build_sdist:
39+
name: Build source distribution
2640
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
2751

52+
upload_pypi:
53+
needs: [build_wheels, build_sdist]
54+
runs-on: ubuntu-latest
55+
if: github.event_name == 'release' && github.event.action == 'published'
2856
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

Comments
 (0)