-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (47 loc) · 1.59 KB
/
Copy pathrelease.yml
File metadata and controls
57 lines (47 loc) · 1.59 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
name: Build release packages
# 在真实的 macOS runner 上打包桌面应用(PyInstaller 无法交叉编译)。
# 触发方式:推送 `v` 开头的版本标签,或在 Actions 页面手动运行。
# 打标签触发时,产物会自动附加到对应的 GitHub Release,
# README 里指向 "latest release" 的下载链接才能生效。
#
# 目前只构建 macOS 包。Windows 用户可从源码自行打包(见 README「打包说明」),
# 应用本身是跨平台的。
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build macOS package
runs-on: macos-latest
env:
ASSET: PyHIDS-macOS.zip
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install project and build tooling
run: |
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"
# 先跑测试再打包:与其发布一个坏掉的安装包,不如让构建直接失败
- name: Run tests
run: python -m pytest -q
- name: Build macOS .app
run: |
pyinstaller --noconfirm pyhids.spec
ditto -c -k --keepParent "dist/PyHIDS.app" "$ASSET"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.ASSET }}
path: ${{ env.ASSET }}
- name: Attach to GitHub Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: ${{ env.ASSET }}