diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index d767ba49..6f5e8554 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -58,13 +58,22 @@ jobs: publish: needs: [build] runs-on: ubuntu-latest - if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags') + if: startsWith(github.ref, 'refs/tags') steps: - uses: actions/download-artifact@v2 with: name: artifact path: dist + + - name: Publish distribution 📦 to test PyPI + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.testpypi_pass }} + repository_url: https://test.pypi.org/legacy/ + - name: Publish distribution 📦 to PyPI + if: ${{ success() }} uses: pypa/gh-action-pypi-publish@master with: user: __token__ diff --git a/bindings/python/build_wheel.sh b/bindings/python/build_wheel.sh index d842a7ba..39ffcb37 100755 --- a/bindings/python/build_wheel.sh +++ b/bindings/python/build_wheel.sh @@ -1,24 +1,15 @@ #!/bin/bash set -e -x -cd /work/bindings/python - -sudo rm /usr/bin/python && sudo ln -s /opt/python/cp36-cp36m/bin/python /usr/bin/python; python -V - -function repair_wheel { - wheel="$1" - if ! auditwheel show "$wheel"; then - echo "Skipping non-platform wheel $wheel" - else - auditwheel repair "$wheel" -w /work/bindings/python/dist/ - fi -} - +cd bindings/python +sudo rm /usr/bin/python && sudo ln -s /opt/python/cp27-cp27m/bin/python /usr/bin/python; python -V # Compile wheels -/opt/python/cp36-cp36m/bin/python setup.py bdist_wheel -d wheelhouse - -# Bundle external shared libraries into the wheels -for whl in wheelhouse/*.whl; do - repair_wheel "$whl" -done +if [ -f /opt/python/cp36-cp36m/bin/python ];then + /opt/python/cp36-cp36m/bin/python setup.py bdist_wheel +else + python3 setup.py bdist_wheel +fi +cd dist +auditwheel repair *.whl +mv -f wheelhouse/*.whl . diff --git a/bindings/python/setup.cfg b/bindings/python/setup.cfg index 5e722cbb..3fdd7b20 100644 --- a/bindings/python/setup.cfg +++ b/bindings/python/setup.cfg @@ -1,2 +1,4 @@ [metadata] description-file = README.pypi-src +[bdist_wheel] +universal = 1