-
Notifications
You must be signed in to change notification settings - Fork 3
142 lines (138 loc) · 6.27 KB
/
Copy pathrelease.yml
File metadata and controls
142 lines (138 loc) · 6.27 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
136
137
138
139
140
141
142
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
package:
permissions:
contents: read
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
with:
submodules: true # 拉取 MaaCommonAssets(OCR 模型来源)
- uses: actions/setup-python@v6
with:
python-version: '3.13'
- uses: astral-sh/setup-uv@v8.1.0
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm check
- run: pnpm check:py
- name: Disable Windows Defender realtime monitoring
shell: powershell
run: |
# PyInstaller 写入 exe 时 Defender 实时扫描会改动 PKG archive,
# 导致产出的 exe "Could not load embedded PKG archive"。打包前关掉。
Set-MpPreference -DisableRealtimeMonitoring $true -ErrorAction SilentlyContinue
Add-MpPreference -ExclusionPath "$env:GITHUB_WORKSPACE" -ErrorAction SilentlyContinue
Write-Host "Defender realtime monitoring disabled for build"
- name: Configure OCR model
run: uv run python tools/configure.py
- name: Convert logo.png to ico
shell: bash
run: uv run python -c "from PIL import Image; Image.open('logo.png').save('logo.ico', format='ICO', sizes=[(256,256),(128,128),(64,64),(48,48),(32,32),(16,16)])"
- name: Build (PyInstaller)
run: uv run pyinstaller aao.spec --noconfirm
- name: Smoke test packaged exe
shell: bash
run: |
# 打包后立即 offscreen 跑,验证 PKG archive 能加载(CI 自检,避免产出损坏的 exe 还发版)
export QT_QPA_PLATFORM=offscreen
timeout 20 ./dist/aao.app/aao.app.exe --no-api > smoke.log 2>&1 || true
if grep -q "Could not load PyInstaller" smoke.log; then
echo "[ERR] packaged exe failed to load PKG archive"
cat smoke.log
exit 1
fi
echo "[OK] packaged exe loads PKG archive"
head -5 smoke.log
- name: Download AFA (ArknightsFrameAssistant)
shell: bash
run: |
mkdir -p dist/aao.app/afa
# AFA 是 GPL-3.0(CloudTracey/arknights-frame-assistant),凹图热键依赖。
# 查最新 release tag,下对应 AFA.exe + LICENSE(满足 GPL 分发要求)。
repo="CloudTracey/arknights-frame-assistant"
tag="$(curl -fsSL "https://api.github.com/repos/$repo/releases/latest" | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p')"
echo "AFA latest tag: $tag"
curl -fsSL "https://github.com/$repo/releases/download/$tag/AFA.exe" -o dist/aao.app/afa/AFA.exe
curl -fsSL "https://raw.githubusercontent.com/$repo/$tag/LICENSE" -o dist/aao.app/afa/LICENSE || echo "[WARN] AFA LICENSE 未取到"
ls -la dist/aao.app/afa/
- name: Sync game data
run: uv run python -m aao.resources.syncer --remote
- name: Stage external resources
shell: bash
run: |
cp -r resource data examples dist/aao.app/
cp logo.png dist/aao.app/
# 清理冒烟测试生成的运行时目录(不该进发版包)
rm -rf dist/aao.app/config dist/aao.app/debug
- name: Package
shell: bash
run: |
mkdir -p dist
archive="ArknightsAutoOperator-win-x64-${GITHUB_REF_NAME}.zip"
( cd dist/aao.app && 7z a "../$archive" . )
- uses: actions/upload-artifact@v7
with:
name: win-x64
path: dist/*.zip
- name: Upload raw dist (诊断 PKG 损坏用)
uses: actions/upload-artifact@v7
with:
name: win-x64-raw
path: dist/aao.app
git_cliff:
name: Generate release notes
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Generate release notes
shell: bash
env:
GITHUB_REPO: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
version="2.13.1"
archive="git-cliff-${version}-x86_64-unknown-linux-gnu.tar.gz"
mkdir -p "$RUNNER_TEMP/git-cliff"
curl -fsSL "https://github.com/orhun/git-cliff/releases/download/v${version}/$archive" -o "$RUNNER_TEMP/$archive"
tar -xzf "$RUNNER_TEMP/$archive" -C "$RUNNER_TEMP/git-cliff"
git_cliff="$(find "$RUNNER_TEMP/git-cliff" -type f -name git-cliff -perm -111 | head -n 1)"
if [[ -z "$git_cliff" ]]; then
echo "[ERR] git-cliff binary was not found after extraction"
exit 1
fi
"$git_cliff" --config .github/cliff.toml --latest --strip header --output CHANGES.md
- name: Upload release notes
uses: actions/upload-artifact@v7
with:
name: release-notes
path: CHANGES.md
release:
if: startsWith(github.ref, 'refs/tags/')
needs: [package, git_cliff]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v7
with:
path: release-assets
merge-multiple: true
- uses: softprops/action-gh-release@v3
with:
body_path: release-assets/CHANGES.md
files: |
release-assets/*.zip