Skip to content

release python

release python #21

Workflow file for this run

# This workflow builds Python distribution packages using cibuildwheel tool and
# environment and publishes packages as a part of a GitHub release.
# This workflow uses actions that are not certified by GitHub. They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.
name: release python
on:
workflow_dispatch:
release:
types: [published]
jobs:
build-wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-13, macos-14]
max-parallel: 3
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- run: |
echo "REF_NAME=${{github.ref_name}}" | tee -a $GITHUB_ENV
echo "EVENT_NAME=${{github.event_name}}" | tee -a $GITHUB_ENV
echo "PRERELEASE=${{github.event.release.prerelease}}" | tee -a $GITHUB_ENV
echo "TAG_NAME=${{github.event.release.tag_name}}" | tee -a $GITHUB_ENV
echo "COMMIT_HEAD=${{github.ref_name != '' && github.ref_name || env.GITHUB_SHA}}" | tee -a $GITHUB_ENV
- name: Build wheels on ${{ matrix.os }}
uses: pypa/[email protected]
env:
CIBW_BEFORE_ALL: sh -c "./python/install-hyperonc.sh -l -u https://github.com/${{github.repository}}.git -r ${{env.COMMIT_HEAD}}"
CIBW_SKIP: "*musllinux*"
with:
package-dir: ./python
- name: Publish Artifacts on GitHub Release
if: github.event.action == 'published'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./wheelhouse/*.whl
tag: ${{ github.ref }}
prerelease: ${{ github.event.release.prerelease }}
overwrite: true
file_glob: true
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: python-wheels
path: ./wheelhouse/*.whl
publish-test-pypi:
name: Publish to Test PyPI
permissions:
id-token: write
environment:
name: test
runs-on: ubuntu-latest
needs: [build-wheels]
if: github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: python-wheels
path: dist
- name: Publish package distributions to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
publish-pypi:
name: Publish to PyPI
permissions:
id-token: write
environment:
name: production
runs-on: ubuntu-latest
needs: [build-wheels]
if: github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: python-wheels
path: dist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1