-
Notifications
You must be signed in to change notification settings - Fork 0
135 lines (114 loc) · 3.97 KB
/
release.yml
File metadata and controls
135 lines (114 loc) · 3.97 KB
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Release wheel
on:
workflow_dispatch:
inputs:
branch:
description: "Create release with branch or sha1"
required: true
version_tag:
description: "Release version (a.b.c)"
required: true
jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-13", "macos-latest"] # "ubuntu-24.04-arm" unsupported
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
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm' }}
run: |
sed -E -i "s/__version__[[:space:]]*=[[:space:]]*['\"][^'\"]+['\"]/__version__ = '${{ github.event.inputs.version_tag }}'/g" pyface/__init__.py
- name: Bump package version
if: ${{ matrix.os == 'macos-13' || matrix.os == 'macos-latest' }}
run: |
sed -E -i '' "s/__version__[[:space:]]*=[[:space:]]*['\"][^'\"]+['\"]/__version__ = '${{ github.event.inputs.version_tag }}'/g" 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 }}
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: unicorn
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: Set up Python (host)
uses: actions/setup-python@v5
with:
check-latest: true
python-version: "3.12"
- 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 }}