Skip to content

Commit c95ff54

Browse files
committed
ci: publish only sdist on PyPi
Pre building the binaries with wheels is difficult, as we would also need to ship the libnvme.so with the Python binding. This is a well known limitation of this kind of setup (binding to a shared library). Most project fallback to just ship the sdist. Though there is a drawback as the C library is missing and the user has to provide the library himself, with all problems which come along with setup. But it seems common practice with other Python bindings, so we don't want to be hostile to the ones which know what they are doing. Normal users should just use the distribution packages anyway. Signed-off-by: Daniel Wagner <[email protected]>
1 parent 033449f commit c95ff54

1 file changed

Lines changed: 25 additions & 34 deletions

File tree

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,58 @@
1-
# This workflow will upload a Python Package using Twine when a release is created
2-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
3-
4-
# This workflow uses actions that are not certified by GitHub.
5-
# They are provided by a third-party and are governed by
6-
# separate terms of service, privacy policy, and support
7-
# documentation.
8-
91
name: Build and upload to PyPI
102

113
on:
124
push:
135
branches: [ master ]
6+
tags:
7+
- '**'
148
pull_request:
159
branches: [ master ]
1610
workflow_dispatch:
1711

1812
jobs:
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
37-
3813
build_sdist:
3914
name: Build source distribution
4015
runs-on: ubuntu-latest
4116
steps:
42-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
4318

4419
- name: Build sdist
4520
run: pipx run build --sdist
4621

47-
- uses: actions/upload-artifact@v2
22+
- uses: actions/upload-artifact@v3
4823
with:
4924
path: dist/*.tar.gz
5025
retention-days: 5
5126

52-
upload_pypi:
53-
needs: [build_wheels, build_sdist]
27+
upload_test_pypi:
28+
needs: [build_sdist]
5429
runs-on: ubuntu-latest
55-
if: github.event_name == 'release' && github.event.action == 'published'
30+
if: startsWith(github.ref, 'refs/tags/v')
5631
steps:
57-
- uses: actions/download-artifact@v2
32+
- uses: actions/download-artifact@v3
5833
with:
5934
name: artifact
6035
path: dist
6136

6237
- name: Publish package to TestPyPI
63-
uses: pypa/gh-action-pypi-publish@release/v1
38+
uses: pypa/gh-action-pypi-publish@release/v1.5
6439
with:
6540
user: __token__
6641
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
6742
repository_url: https://test.pypi.org/legacy/
43+
44+
upload_pypi:
45+
needs: [build_sdist]
46+
runs-on: ubuntu-latest
47+
if: startsWith(github.ref, 'refs/tags/v')
48+
steps:
49+
- uses: actions/download-artifact@v3
50+
with:
51+
name: artifact
52+
path: dist
53+
54+
- name: Publish package to PyPI
55+
uses: pypa/gh-action-pypi-publish@release/v1.5
56+
with:
57+
user: __token__
58+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)