Skip to content

Commit b9983e2

Browse files
committed
[添加 ICNS 自动生成工作流及调试功能]
- 新增 GitHub Actions 工作流:当 icns 目录内容变更时自动触发 ICNS 图标生成任务 - 新增两个图标源文件:crash-report.png 和 qt-app.png 用于生成 ICNS - 增强 make_icns.py 脚本:添加 iconset 目录生成文件的调试输出功能 - 工作流包含完整处理链:生成 ICNS → 验证文件结构 → 展示目录树 → 上传产物 - 使用 macOS 环境运行,确保 iconutil 工具可用性
1 parent b0d0abe commit b9983e2

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed

.github/workflows/make-icns.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Make ICNS
2+
3+
on:
4+
push:
5+
paths:
6+
- 'icns/**'
7+
pull_request:
8+
paths:
9+
- 'icns/**'
10+
11+
jobs:
12+
build:
13+
name: Make ICNS
14+
runs-on: macos-latest
15+
16+
steps:
17+
- uses: actions/checkout@v5
18+
with:
19+
fetch-depth: 1
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v6
23+
with:
24+
python-version: '3.13'
25+
26+
- name: Create and activate virtual environment, install dependencies, and generate icons
27+
shell: bash
28+
run: |
29+
source activate_venv.sh
30+
31+
python3 -m pip install --upgrade pip
32+
pip install -e .
33+
34+
for img in icns/*; do
35+
python3 image-toolkit/make_icns.py "$img" --engine iconutil
36+
done
37+
38+
for icns in icns/*.icns; do
39+
python3 image-toolkit/dump_icns.py "$icns" -s
40+
done
41+
42+
python3 tree/tree.py icns -r -f
43+
44+
deactivate
45+
46+
- name: Upload ICNS files
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: icns-files
50+
path: icns/*.icns
51+

icns/crash-report.png

103 KB
Loading

icns/qt-app.png

158 KB
Loading

image-toolkit/make_icns.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ def build_icns_iconutil(source_img: Image.Image, output_icns: str):
5454
filename = f"icon_{size}x{size}{suffix}.png"
5555
img_scaled.save(os.path.join(iconset, filename))
5656

57+
# ---- 新增:列出 iconset 里实际生成的文件 ----
58+
from pathlib import Path
59+
60+
print("iconset 目录内容:")
61+
for p in sorted(Path(iconset).glob("*.png")):
62+
print(" ", p.name)
63+
# ------------------------------------------
64+
5765
# 调用系统 iconutil 生成 icns
5866
subprocess.run(["iconutil", "-c", "icns", iconset, "-o", output_icns], check=True)
5967
# 清理

0 commit comments

Comments
 (0)