mirror of
https://github.com/qingchencloud/clawpanel.git
synced 2026-06-25 17:54:10 +08:00
- README: 新增下载安装区(macOS/Windows/Linux 分系统引导)、补充功能特性(10 个页面模块)、更新目录结构 - CHANGELOG: 重写 v0.1.0 变更记录,按 Keep a Changelog 格式详列所有功能 - release.yml: 动态生成 Release Body(含版本化下载引导表 + git log 自动 changelog),fetch-depth: 0 拉全量历史 - 已同步更新 v0.1.0 Release 页面描述
186 lines
5.8 KiB
YAML
186 lines
5.8 KiB
YAML
# 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:
|
||
release:
|
||
name: 构建 (${{ matrix.platform.name }})
|
||
runs-on: ${{ matrix.platform.os }}
|
||
permissions:
|
||
contents: write
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
platform:
|
||
# macOS Apple Silicon (ARM64)
|
||
- name: macOS (ARM64)
|
||
os: macos-latest
|
||
args: --target aarch64-apple-darwin
|
||
rust_target: aarch64-apple-darwin
|
||
# macOS Intel (x64)
|
||
- name: macOS (Intel)
|
||
os: macos-latest
|
||
args: --target x86_64-apple-darwin
|
||
rust_target: x86_64-apple-darwin
|
||
# Linux x86_64
|
||
- name: Linux (x64)
|
||
os: ubuntu-latest
|
||
args: ""
|
||
rust_target: ""
|
||
# Windows x86_64
|
||
- name: Windows (x64)
|
||
os: windows-latest
|
||
args: ""
|
||
rust_target: ""
|
||
|
||
steps:
|
||
# 签出代码
|
||
- name: 签出代码
|
||
uses: actions/checkout@v4
|
||
with:
|
||
fetch-depth: 0
|
||
|
||
# 安装 Node.js 22
|
||
- name: 安装 Node.js
|
||
uses: actions/setup-node@v4
|
||
with:
|
||
node-version: 22
|
||
cache: npm
|
||
|
||
# 安装前端依赖
|
||
- name: 安装前端依赖
|
||
run: npm ci
|
||
|
||
# 安装 Rust 工具链 (stable)
|
||
- name: 安装 Rust 工具链
|
||
uses: dtolnay/rust-toolchain@stable
|
||
with:
|
||
targets: ${{ matrix.platform.rust_target }}
|
||
|
||
# Rust 编译缓存
|
||
- name: Rust 编译缓存
|
||
uses: swatinem/rust-cache@v2
|
||
with:
|
||
workspaces: src-tauri -> target
|
||
|
||
# Linux 专用: 安装 Tauri v2 系统依赖
|
||
- 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: 设置 Release 标签
|
||
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
|
||
|
||
# 生成 Release Body(下载引导 + 动态 changelog)
|
||
- name: 生成 Release Body
|
||
id: release_body
|
||
shell: bash
|
||
run: |
|
||
VERSION="${TAG_NAME#v}"
|
||
|
||
# 获取上一个 tag,用于生成 changelog
|
||
PREV_TAG=$(git tag --sort=-v:refname | grep -E '^v' | sed -n '2p' || echo "")
|
||
|
||
# 动态生成 changelog
|
||
if [ -n "$PREV_TAG" ]; then
|
||
CHANGELOG=$(git log "${PREV_TAG}..HEAD" --pretty=format:"- %s" --no-merges | head -30)
|
||
CHANGELOG_HEADER="自 ${PREV_TAG} 以来的更新"
|
||
else
|
||
CHANGELOG=$(git log --pretty=format:"- %s" --no-merges -20)
|
||
CHANGELOG_HEADER="主要更新"
|
||
fi
|
||
|
||
# 写入 Release Body
|
||
cat > release_body.md << ENDOFBODY
|
||
## 下载安装
|
||
|
||
根据你的操作系统选择对应安装包:
|
||
|
||
### macOS
|
||
| 芯片 | 安装包 | 说明 |
|
||
|------|--------|------|
|
||
| Apple Silicon (M1/M2/M3/M4) | \`ClawPanel_${VERSION}_aarch64.dmg\` | 2020 年末及之后的 Mac |
|
||
| Intel | \`ClawPanel_${VERSION}_x64.dmg\` | 2020 年及之前的 Mac |
|
||
|
||
> 不确定芯片类型?点击左上角 → 关于本机,查看「芯片」一栏。
|
||
|
||
### Windows
|
||
| 格式 | 安装包 | 说明 |
|
||
|------|--------|------|
|
||
| EXE 安装器 | \`ClawPanel_${VERSION}_x64-setup.exe\` | 推荐,双击安装 |
|
||
| MSI 安装器 | \`ClawPanel_${VERSION}_x64_en-US.msi\` | 企业部署 / 静默安装 |
|
||
|
||
### Linux
|
||
| 格式 | 安装包 | 说明 |
|
||
|------|--------|------|
|
||
| AppImage | \`ClawPanel_${VERSION}_amd64.AppImage\` | 免安装,\`chmod +x\` 后直接运行 |
|
||
| DEB | \`ClawPanel_${VERSION}_amd64.deb\` | Debian / Ubuntu:\`sudo dpkg -i *.deb\` |
|
||
| RPM | \`ClawPanel-${VERSION}-1.x86_64.rpm\` | Fedora / RHEL:\`sudo rpm -i *.rpm\` |
|
||
|
||
---
|
||
|
||
## ${CHANGELOG_HEADER}
|
||
|
||
${CHANGELOG}
|
||
|
||
---
|
||
|
||
完整更新日志请查看 [CHANGELOG.md](https://github.com/qingchencloud/clawpanel/blob/main/CHANGELOG.md)
|
||
ENDOFBODY
|
||
|
||
# 去除 heredoc 缩进
|
||
sed -i.bak 's/^ //' release_body.md && rm -f release_body.md.bak
|
||
|
||
# 使用 tauri-action 构建并发布
|
||
- name: 构建 Tauri 应用
|
||
uses: tauri-apps/tauri-action@v0
|
||
env:
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
with:
|
||
tagName: ${{ env.TAG_NAME }}
|
||
releaseName: "ClawPanel ${{ env.TAG_NAME }}"
|
||
releaseBody: "构建中,稍后更新..."
|
||
releaseDraft: false
|
||
prerelease: false
|
||
args: ${{ matrix.platform.args }}
|
||
|
||
# 更新 Release Body(仅第一个完成的 job 执行)
|
||
- name: 更新 Release 描述
|
||
if: always()
|
||
shell: bash
|
||
env:
|
||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
run: |
|
||
# 检查当前 Release body 是否为空或默认值,避免重复更新
|
||
CURRENT_BODY=$(gh release view "$TAG_NAME" --json body -q '.body' 2>/dev/null || echo "")
|
||
if [ ${#CURRENT_BODY} -lt 100 ]; then
|
||
gh release edit "$TAG_NAME" --notes-file release_body.md
|
||
fi
|