Skip to content

Release wheel

Release wheel #14

Workflow file for this run

name: Release wheel
on:
workflow_dispatch:
inputs:
branch:
description: "Create release with branch or sha1"
default: "main"
required: true
version_tag:
description: "Release version (a.b.c)"
required: true
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }} / py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "ubuntu-24.04-arm", "macos-13", "macos-latest"]
python-version: ["3.10", "3.12"]
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
token: ${{ secrets.CI_PAT_DS }}
fetch-depth: 0
- name: Set up Python (host)
uses: actions/setup-python@v5
with:
check-latest: true
python-version: "3.12"
- name: Bump package version
run: |
sed -i.bak "s/__version__ = .*/__version__ = '${{ github.event.inputs.version_tag }}'/" pyface/__init__.py || \
sed -i "s/__version__ = .*/__version__ = '${{ github.event.inputs.version_tag }}'/" pyface/__init__.py
- name: Install tools
run: |
python -m pip install -U pip setuptools wheel cibuildwheel
- name: Build wheels with cibuildwheel
run: |
python -m cibuildwheel --output-dir wheelhouse
- name: Upload wheel artifacts
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}-py${{ matrix.python-version }}
path: wheelhouse/*.whl
if-no-files-found: error
retention-days: 3
overwrite: true
- name: Clean workspace when fail
if: failure()
run: |
rm -rf ${{ github.workspace }}
release:
name: Create GitHub Release
needs: build_wheels
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
token: ${{ secrets.CI_PAT_DS }}
fetch-depth: 0
- name: Update Python version
run: |
sed -i "s/__version__ = '[0-9]\+\(\.[0-9]\+\)\{1,2\}\(rc[0-9]\+\|[ab][0-9]\+\)\?'/__version__ = '${{ github.event.inputs.version_tag }}'/g" pyface/__init__.py
- name: Commit & Push changes of Version Updating
uses: actions-js/push@master
with:
branch: ${{ github.event.inputs.branch }}
message: "[C] Update package version"
github_token: ${{ secrets.CI_PAT_DS }}
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: wheelhouse
- name: List downloaded artifacts
run: ls -al wheelhouse
- name: Create GitHub Release (attach wheels)
uses: ncipollo/release-action@v1
with:
tag: ${{ github.event.inputs.version_tag }}
name: Release ${{ github.event.inputs.version_tag }}
body: |
# Release Notes
allowUpdates: true
artifactErrorsFailBuild: true
draft: true
prerelease: false
generateReleaseNotes: true
discussionCategory: General
artifacts: |
wheelhouse/*.whl
# - name: Twine check & upload to PyPI
# run: |
# python -m twine check wheelhouse/*
# python -m twine upload --skip-existing wheelhouse/*.whl
- name: Clean artifacts
if: always()
run: rm -rf dist wheelhouse build *.egg-info
- name: Clean workspace when fail
if: failure()
run: |
rm -rf ${{ github.workspace }}