Repository navigation
86 lines (74 loc) · 2.54 KB
/
Copy pathpm-cli-release.yml
File metadata and controls
86 lines (74 loc) · 2.54 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
# pm CLI 多平台构建 + Release 发布
#
# 触发方式:
# 1. 推送 tag pm-v*(如 pm-v0.1.0)→ 构建四平台二进制并发布到 GitHub Release
# 2. workflow_dispatch 手动触发 → 只构建并上传 workflow artifact(用于验证)
#
# 产物命名:pm-darwin-arm64 / pm-darwin-x86_64 / pm-linux-x86_64 / pm-windows-x86_64.exe
# 注意:macOS 产物未做 Apple 公证,用户首次运行需
# xattr -d com.apple.quarantine pm (或在「系统设置 → 隐私与安全性」放行)
name: pm-cli-release
on:
push:
tags:
- "pm-v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: macos-14 # Apple Silicon
target: darwin-arm64
- os: macos-13 # Intel
target: darwin-x86_64
- os: ubuntu-22.04
target: linux-x86_64
- os: windows-latest
target: windows-x86_64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
# CLI 只依赖 typer + httpx,无需安装整个 papermind 包(避免拖入 fastapi/pgvector 等)
- name: Install build dependencies
run: pip install "typer>=0.12" "httpx>=0.28.1" "pyinstaller>=6.0"
- name: Build binary
run: >
pyinstaller --onefile --clean --noconfirm --name pm
--paths .
--hidden-import "apps.cli.main"
--hidden-import "apps.cli.client"
--hidden-import "apps.cli.config"
--collect-data certifi
apps/cli/__main__.py
- name: Smoke test (--version, unix)
if: runner.os != 'Windows'
run: dist/pm --version
- name: Smoke test (--version, windows)
if: runner.os == 'Windows'
shell: pwsh
run: dist\pm.exe --version
- name: Rename artifact (unix)
if: runner.os != 'Windows'
run: mv dist/pm "dist/pm-${{ matrix.target }}"
- name: Rename artifact (windows)
if: runner.os == 'Windows'
shell: pwsh
run: Move-Item dist\pm.exe "dist/pm-${{ matrix.target }}.exe"
- uses: actions/upload-artifact@v4
with:
name: pm-${{ matrix.target }}
path: dist/pm-*
if-no-files-found: error
- name: Attach to GitHub Release
if: startsWith(github.ref, 'refs/tags/pm-v')
uses: softprops/action-gh-release@v2
with:
files: dist/pm-*
generate_release_notes: true