From 0537cb0c7b3a9ffbe9b28e75a5fc32009007ee5e Mon Sep 17 00:00:00 2001 From: Will Ayd Date: Thu, 21 Nov 2024 18:35:51 -0500 Subject: [PATCH] CI: Automate pypi wheel publishing --- .github/workflows/pypi_publish.yml | 51 ++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/pypi_publish.yml diff --git a/.github/workflows/pypi_publish.yml b/.github/workflows/pypi_publish.yml new file mode 100644 index 000000000..f7f52ba76 --- /dev/null +++ b/.github/workflows/pypi_publish.yml @@ -0,0 +1,51 @@ +name: Build and upload to PyPI + +on: + workflow_dispatch: + release: + types: [published] + +jobs: + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v4 + + - name: Build wheels + uses: pypa/cibuildwheel@v2.21.3 + env: + CIBW_BEFORE_ALL: cd python + + - uses: actions/upload-artifact@v4.4.0 + with: + name: artifacts-${{ matrix.os }} + path: ./wheelhouse/*.whl + + upload_pypi: + needs: [build_wheels] + runs-on: ubuntu-latest + environment: + name: testpypi + url: https://test.pypi.org/project/arrow-nanoarrow/ + permissions: + id-token: write + # TODO: add back in the below condition when productionalized + # if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + steps: + - uses: actions/download-artifact@v4.1.8 + with: + # unpacks default artifact into dist/ + # https://github.com/actions/upload-artifact/issues/480#issuecomment-1937762859 + pattern: artifacts-* + merge-multiple: true + path: dist + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ # currently pointing to test env