Skip to content

Publish wheel

Publish wheel #99

Workflow file for this run

# 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: Publish wheel
on:
workflow_dispatch:
inputs:
tag:
description: "Tag to publish (manual run)"
required: true
jobs:
build_wheels:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- {os: ubuntu-latest, arch: x86_64, linux_image: manylinux2014, build_sdist: "true"}
- {os: ubuntu-latest, arch: x86_64, linux_image: manylinux_2_28, build_sdist: "false"}
- {os: ubuntu-24.04-arm, arch: aarch64, linux_image: manylinux2014, build_sdist: "false"}
- {os: ubuntu-24.04-arm, arch: aarch64, linux_image: manylinux_2_28, build_sdist: "false"}
- {os: windows-latest, arch: AMD64, linux_image: "", build_sdist: "false"}
- {os: macos-14, arch: arm64, linux_image: "", build_sdist: "false"}
steps:
- name: Checkout repository (for local composite action)
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Build wheel
uses: ./.github/actions/build-wheel-for-publish
with:
os: ${{ matrix.os }}
arch: ${{ matrix.arch }}
linux_image: ${{ matrix.linux_image }}
checkout_ref: ${{ inputs.tag }}
build_sdist: ${{ matrix.build_sdist }}
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: cibw-wheels-${{ matrix.os }}-${{ matrix.arch }}-${{ strategy.job-index }}
path: ./wheelhouse/*.whl
- name: Upload sdist
if: ${{ matrix.build_sdist == 'true' }}
uses: actions/upload-artifact@v4
with:
name: cibw-sdist
path: dist/*.tar.gz
upload_pypi:
needs: [build_wheels]
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
attestations: write
if: github.event_name == 'workflow_dispatch' # <-- publish only on manual trigger
steps:
- uses: actions/download-artifact@v4
with:
# unpacks all CIBW artifacts into dist/
pattern: cibw-*
path: dist
merge-multiple: true
- name: Generate artifact attestation for sdist and wheels
uses: actions/attest-build-provenance@v1
with:
subject-path: dist/*
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
verbose: true
# testing publish url
# repository-url: https://test.pypi.org/legacy/