From 27deec31552c69856e56f34cece366cf09f46716 Mon Sep 17 00:00:00 2001 From: Geovane Fedrecheski Date: Wed, 14 Feb 2024 12:00:28 +0100 Subject: [PATCH] ci: publish python wheels on release --- .github/workflows/python-wheels.yml | 47 ++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-wheels.yml b/.github/workflows/python-wheels.yml index a00cb102..d5f9418a 100644 --- a/.github/workflows/python-wheels.yml +++ b/.github/workflows/python-wheels.yml @@ -16,13 +16,13 @@ jobs: matrix: os: [ ubuntu-latest, - windows-latest, - macos-13, # latest non-beta version + # windows-latest, + # macos-13, # latest non-beta version ] # see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners python-version: [ '3.10', '3.11', - '3.12' + # '3.12' ] # see https://devguide.python.org/versions/ steps: @@ -42,12 +42,49 @@ jobs: - name: Install maturin run: python -m pip install maturin + - name: Build source distribution # do this only once + run: | + cd lakers-python + maturin build --sdist --out wheelhouse + if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11' + - name: Build wheels run: | cd lakers-python - maturin build --out wheelhouse + maturin build --release --out wheelhouse - uses: actions/upload-artifact@v4 with: name: wheel-${{ matrix.os }}-python-${{ matrix.python-version }} - path: ./lakers-python/wheelhouse/*.whl + path: ./lakers-python/wheelhouse/lakers_python* + + release: + runs-on: ubuntu-latest + needs: [build-python-wheels] + # if: >- + # github.event_name == 'push' && + # startsWith(github.event.ref, 'refs/tags') + + steps: + - uses: actions/checkout@v4 + + - name: set up python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + + - run: pip install -U twine + + - name: get wheelhouse artifacts + uses: actions/download-artifact@v4 + with: + path: wheelhouse + + - run: ls -lah ./wheelhouse/*/lakers_python* + - run: twine check ./wheelhouse/*/lakers_python* + + - name: upload to pypi + run: twine upload wheelhouse/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_UPLOAD_TOKEN }}