Skip to content

launcher: 托盘图标改用内嵌多尺寸 .ico,修复深色任务栏下不可见 #15

launcher: 托盘图标改用内嵌多尺寸 .ico,修复深色任务栏下不可见

launcher: 托盘图标改用内嵌多尺寸 .ico,修复深色任务栏下不可见 #15

# agent-node 自动发版:打 tag → 把 tag 版本写回 node/version.py → 创建源码 Release
#
# 触发方式:
# git tag v0.2.0 && git push --tags
#
# 不再发布 npm(安装走 irm|iex 源码 zip / 源码运行,见 README)。tag 是唯一版本事实来源
# (node/version.py 注释与 VERSIONS.md 约定);本 workflow 发版时把 tag 版本写回 version.py
# 并提交回 main(main-zip 部署形态无 .git,只能读 VERSION 常量,故需要此同步)。
name: agent-node release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
permissions:
contents: write # 写回 main + 创建 Release
jobs:
release:
runs-on: ubuntu-latest
steps:
# 直接以 main 为 checkout 目标:tag 事件下 GITHUB_REF 仍是 tag,取版本不受影响;
# 若默认 checkout tag 会处于 detached HEAD,还需再切 main,且本地未必有 main 分支引用。
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: launcher/go.mod
cache-dependency-path: launcher/go.sum
- name: Resolve tag version
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
# 构建 Go 启动器(release 资产:用户下载双击即用的单体 exe)。
# systray 在 windows 依赖 cgo,故用 mingw-w64 交叉编译,-H windowsgui 去控制台窗口。
# 仓库不再提交二进制(见 .gitignore),exe 仅在发布时构建产出。
- name: Build launcher exe
run: |
sudo apt-get update
sudo apt-get install -y gcc-mingw-w64-x86-64
mkdir -p bin
cd launcher
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc \
go build -trimpath -ldflags "-H windowsgui -s -w" -o ../bin/agent-node-launcher.exe .
# 把 tag 版本写入 node/version.py(纯 Python,无 npm;同版本幂等)
- name: Bump version.py
run: python3 scripts/bump_version.py "${{ steps.tag.outputs.tag }}"
# 写回 main:main-zip 部署形态读取该常量显示版本。先 pull --rebase 以吸收
# 发版窗口内的并发提交,避免非快进被拒;main 若开分支保护需单独放行 bot。
- name: Commit version back to main
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add node/version.py
if git diff --cached --quiet; then
echo "version.py 无需变更,跳过写回"
else
git pull --rebase origin main --autostash || git rebase --abort
git commit -m "chore: sync version ${GITHUB_REF#refs/tags/}"
git push origin HEAD:main
echo "已把版本号写回 main"
fi
# 创建源码 Release(安装脚本用的源代码 zip),非必须但便于发版留痕;
# allowUpdates 使同 tag 重跑不失败(配合 bump 幂等),Release 归档包取自写回前的 tag 提交,
# 版本号可能略旧,但 install.ps1 从 main zip 取版本,部署无影响,此处仅留痕。
- name: Create source release
if: success()
uses: softprops/action-gh-release@v2
with:
name: "${{ steps.tag.outputs.tag }}"
tag_name: "${{ steps.tag.outputs.tag }}"
generate_release_notes: true
allowUpdates: true
files: bin/agent-node-launcher.exe # 用户下载双击即用的启动器(release 资产)