Skip to content

Commit

Permalink
CI: Automate pypi wheel publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
WillAyd committed Nov 21, 2024
1 parent e54b7df commit 4a550e5
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/pypi_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

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

0 comments on commit 4a550e5

Please sign in to comment.