This repository has been archived by the owner on Jun 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
73 lines (67 loc) · 2.16 KB
/
build.yaml
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
name: 编译构建
permissions:
contents: write
on:
push:
jobs:
build:
name: 编译构建(${{ matrix.os }} amd64)
strategy:
matrix:
os: [ubuntu, macos, windows]
fail-fast: false
runs-on: ${{ matrix.os }}-latest
steps:
- name: 检出仓库
uses: actions/checkout@v4
- name: 安装 MSVC
if: ${{ matrix.os }} == 'windows'
# Runner 模式预装 MinGW-w64 用于编译 NumPy
# 这还只是实验性质的功能,当 PyInstaller 打包时会崩溃
# 我们需要安装配置 MSVC ,让 PDM 用它去编译构建 NumPy
uses: seanmiddleditch/gha-setup-vsdevenv@v4
with:
arch: amd64
host_arch: amd64
- name: 配置 PDM 构建环境
uses: pdm-project/setup-pdm@v4
with:
python-version: 3.11
architecture: x64
cache: true
- name: 安装依赖项和提交钩子
run: |-
echo "::group::安装依赖项"
pdm install
echo "::endgroup::"
echo "::group::安装提交钩子"
pdm run git
echo "::endgroup::"
- name: 执行持续集成检查
run: pdm run ci
- name: 编译打包
# macOS 的图标使用 *.icns 而非 *.ico
# 因此 Dev Dependencies 中的 Pillow 是必要的
# PyInstaller 会使用它转换图标格式
run: pdm run build "Numzle-${{ matrix.os }}_amd64"
- name: 发布每日构建
if: startsWith(github.ref, 'refs/heads/')
uses: actions/upload-artifact@v4
with:
name: Numzle-${{ matrix.os }}_amd64
path: dist/Numzle*
retention-days: 7
- name: 生成发布说明
id: changelog
if: startsWith(github.ref, 'refs/tags/')
run: |-
git log -n 1 --pretty="format: ## %s%n%n%b" > CHANGELOG.txt
- name: 发布构建产物
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
body_path: CHANGELOG.txt
draft: true
prerelease: ${{ startsWith(github.ref_name, 'v0') }}
files: |-
dist/Numzle*