Update microsoft/setup-msbuild action to v2 (#49) #63
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Python Wheels | |
on: | |
push: | |
tags: | |
- '\d+\.\d+\.[0-9a-z]+' | |
workflow_dispatch: | |
inputs: | |
reason: | |
description: 'Reason for running workflow' | |
required: true | |
jobs: | |
build_wheels: | |
name: Build Py3 Wheel on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
steps: | |
- name: Log reason (manual run only) | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
echo "Reason for triggering: ${{ github.event.inputs.reason }}" | |
- name: Check out | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # unshallow fetch for setuptools-scm | |
- name: Install Python 3.9 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Set up msbuild (Windows only) | |
uses: microsoft/[email protected] | |
if: startsWith(matrix.os, 'windows') | |
- name: Build wheel | |
uses: pypa/[email protected] | |
with: | |
output-dir: dist | |
env: | |
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-*" | |
CIBW_ARCHS_MACOS: x86_64 arm64 | |
CIBW_ENVIRONMENT_MACOS: "CFLAGS='-arch arm64 -arch x86_64' CXXFLAGS='-arch arm64 -arch x86_64' LDFLAGS='-arch arm64 -arch x86_64'" | |
CIBW_ARCHS_LINUX: x86_64 | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_SKIP: "*musllinux*" | |
CIBW_BEFORE_ALL_LINUX: "yum install -y libuuid-devel" | |
- name: Build sdist (Ubuntu only) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
python setup.py sdist | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheelstorage-${{ matrix.os }} | |
path: ./dist/* | |
if-no-files-found: error | |
retention-days: 30 | |
publish_release: | |
name: Publish Release | |
needs: | |
- build_wheels | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
permissions: | |
id-token: write | |
contents: write # Required by 'action-gh-release' | |
steps: | |
- name: Get date & flat tag | |
id: date_tag | |
run: | | |
export DATE=$(TZ=US/Pacific date +'%Y-%m-%d') | |
echo $DATE | |
export FLAT_TAG=$(echo ${GITHUB_REF##*/}) | |
echo $FLAT_TAG | |
echo "TODAY=$DATE" >> "$GITHUB_OUTPUT" | |
echo "VERSION=$FLAT_TAG" >> "$GITHUB_OUTPUT" | |
shell: bash | |
- name: Download release assets for ${{ matrix.os }} | |
uses: actions/download-artifact@v4 | |
with: | |
name: wheelstorage-${{ matrix.os }} | |
path: dist | |
- name: Publish dist(s) to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body: '${{ steps.date_tag.outputs.VERSION }} released ${{ steps.date_tag.outputs.TODAY }} - [Upstream OTS v${{ steps.date_tag.outputs.VERSION }} Release Notes](https://github.com/khaledhosny/ots/releases/tag/v${{ steps.date_tag.outputs.VERSION }})' | |
prerelease: true | |
files: ./dist/* |