Files
clawpanel/.github/workflows/release.yml
晴天 e62f270422 chore: 跨平台构建脚本 + CI/CD 改进 + 行尾规范
- 新增 .gitattributes 统一 LF 行尾,解决 Mac/Windows 协作 CRLF 问题
- 新增 build.ps1 Windows 本地构建脚本(支持 -Debug/-Clean 参数)
- 新增 build.sh macOS/Linux 本地构建脚本
- 新增 .windsurf/workflows/release.md 发版操作工作流
- release.yml: 将 Release Notes 更新抽为独立 job,彻底解决多 matrix job 竞争条件
- release.yml: 补充代码签名环境变量注释占位,开源后可直接配 Secrets 启用
- ci.yml: 增加 cargo fmt --check 和 cargo clippy -D warnings 质量门禁
- .gitignore: 补充 Windows 平台特有文件、内部报告、IDE 文件
- docs/index.html: 修正 openclaw 仓库 URL
- README.md: 修正 openclaw 仓库 URL
2026-03-04 12:17:48 +08:00

208 lines
6.8 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ClawPanel 发布构建工作流
# 推送 v* 标签时自动构建跨平台产物并创建 GitHub Release
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag_name:
description: '发布版本号 (例如: v1.0.0)'
required: true
type: string
default: 'v1.0.0'
jobs:
# ── 跨平台构建 job ─────────────────────────────────────────────────────────
build:
name: 构建 (${{ matrix.platform.name }})
runs-on: ${{ matrix.platform.os }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
platform:
- name: macOS (Apple Silicon)
os: macos-latest
args: --target aarch64-apple-darwin
rust_target: aarch64-apple-darwin
- name: macOS (Intel)
os: macos-latest
args: --target x86_64-apple-darwin
rust_target: x86_64-apple-darwin
- name: Linux (x64)
os: ubuntu-latest
args: ""
rust_target: ""
- name: Windows (x64)
os: windows-latest
args: ""
rust_target: ""
steps:
- name: 签出代码
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 设置版本标签
id: vars
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> "$GITHUB_ENV"
else
echo "TAG_NAME=${{ github.ref_name }}" >> "$GITHUB_ENV"
fi
- name: 安装 Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: 安装前端依赖
run: npm ci
- name: 安装 Rust 工具链
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.rust_target }}
- name: Rust 编译缓存
uses: swatinem/rust-cache@v2
with:
workspaces: src-tauri -> target
key: ${{ matrix.platform.name }}
- name: 安装 Linux 系统依赖
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
librsvg2-dev \
patchelf \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev
- name: 构建 Tauri 应用
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# macOS 代码签名(可选)
# APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
# APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
# APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
# APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
# Windows 代码签名(可选)
# TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
# TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
tagName: ${{ env.TAG_NAME }}
releaseName: "ClawPanel ${{ env.TAG_NAME }}"
releaseBody: "正在构建所有平台安装包,请稍候..."
releaseDraft: false
prerelease: false
args: ${{ matrix.platform.args }}
# ── 所有平台构建完成后,统一更新 Release Notes ─────────────────────────────
# 独立 job 确保只执行一次,彻底避免多个 matrix job 的竞争条件
update-release-notes:
name: 更新 Release Notes
needs: build
runs-on: ubuntu-latest
if: always() && needs.build.result != 'cancelled'
permissions:
contents: write
steps:
- name: 签出代码
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: 设置版本标签
shell: bash
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> "$GITHUB_ENV"
else
echo "TAG_NAME=${{ github.ref_name }}" >> "$GITHUB_ENV"
fi
- name: 生成并更新 Release Notes
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BUILD_RESULT: ${{ needs.build.result }}
run: |
VERSION="${TAG_NAME#v}"
PREV_TAG=$(git tag --sort=-v:refname | grep -E '^v' | sed -n '2p' || echo "")
if [ -n "$PREV_TAG" ]; then
CHANGELOG=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s" --no-merges | head -30 || echo "")
CHANGELOG_HEADER="自 ${PREV_TAG} 以来的变更"
else
CHANGELOG=$(git log --pretty=format:"- %s" --no-merges -20 || echo "")
CHANGELOG_HEADER="主要变更"
fi
# 构建状态标记
if [ "$BUILD_RESULT" = "success" ]; then
STATUS_BADGE="✅ 全部平台构建成功"
else
STATUS_BADGE="⚠️ 部分平台构建失败,请查看 [Actions 日志](https://github.com/${{ github.repository }}/actions)"
fi
cat > release_body.md << 'ENDOFBODY'
PLACEHOLDER
ENDOFBODY
cat > release_body.md << ENDOFBODY
${STATUS_BADGE}
## 下载安装
根据你的操作系统选择对应安装包:
### macOS
| 芯片 | 安装包 |
|------|--------|
| Apple Silicon (M1/M2/M3/M4) | \`ClawPanel_${VERSION}_aarch64.dmg\` |
| Intel | \`ClawPanel_${VERSION}_x64.dmg\` |
> 首次打开提示"无法验证开发者":前往**系统设置 → 隐私与安全性**,点击「仍要打开」。
### Windows
| 格式 | 安装包 |
|------|--------|
| EXE 安装器(推荐) | \`ClawPanel_${VERSION}_x64-setup.exe\` |
| MSI 安装器 | \`ClawPanel_${VERSION}_x64_en-US.msi\` |
### Linux
| 格式 | 安装包 |
|------|--------|
| AppImage免安装 | \`ClawPanel_${VERSION}_amd64.AppImage\` |
| DEBDebian/Ubuntu | \`ClawPanel_${VERSION}_amd64.deb\` |
| RPMFedora/RHEL | \`ClawPanel-${VERSION}-1.x86_64.rpm\` |
---
## ${CHANGELOG_HEADER}
${CHANGELOG}
---
完整日志见 [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md)
ENDOFBODY
gh release edit "$TAG_NAME" --notes-file release_body.md