-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (91 loc) · 2.98 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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/*