Files
mqttx/pipeline.yml
T
Joe Allen 41929dc7c2 ci: 添加云效流水线配置 (pipeline.yml)
- lint 阶段:pnpm 安装 + vue-tsc 类型检查
- build-linux 阶段:Tauri 系统依赖 + Rust 安装 + pnpm tauri build
- 支持 TAURI_SIGNING_KEY 签名更新构件
- release 阶段(标签触发):生成更新 JSON 元数据
2026-08-20 15:58:39 +08:00

133 lines
4.9 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.
# =============================================================================
# MQTTX — 云效流水线配置 (Alibaba Cloud Flow / Codeup)
# =============================================================================
# 触发方式:推送 master 分支或创建标签时自动运行
# 构建环境:云效默认 Linux 构建机 (Ubuntu)
# 产出产物:AppImage (Linux) + 更新签名
#
# 前置准备 — 在云效流水线「变量」中设置:
# TAURI_SIGNING_KEY — Tauri 更新签名私钥 (base64 编码)
# TAURI_SIGNING_PASSWORD — 签名私钥密码
# UPDATER_ENDPOINT — 更新服务器地址(可选,用于替换默认值)
# =============================================================================
stages:
# ── 阶段 1:代码检查与类型校验 ──────────────────────────────────────
lint:
jobs:
lint-job:
steps:
- checkout: {}
- run:
name: 安装 pnpm
command: npm install -g pnpm
- run:
name: 安装依赖
command: pnpm install
- run:
name: Vue 类型检查
command: pnpm exec vue-tsc --noEmit
# ── 阶段 2:Linux 构建 (AppImage) ──────────────────────────────────
build-linux:
needs: [lint]
jobs:
build-linux-job:
steps:
- checkout: {}
# ---------- 系统依赖 ----------
- run:
name: 安装 Tauri 系统依赖
command: |
apt-get update -qq
apt-get install -y -qq \
libwebkit2gtk-4.1-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
patchelf \
libssl-dev \
libsoup-3.0-dev \
libjavascriptcoregtk-4.1-dev
# ---------- Rust ----------
- run:
name: 安装 Rust 工具链
command: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs \
| sh -s -- -y --default-toolchain stable
# 将 cargo 加入全局 PATH 供后续步骤使用
echo "export PATH=\"$HOME/.cargo/bin:$PATH\"" >> ~/.bashrc
# ---------- Node.js / pnpm ----------
- run:
name: 安装 pnpm
command: npm install -g pnpm
- run:
name: 安装前端依赖
command: |
source ~/.bashrc
pnpm install
# ---------- 构建 Tauri (Linux) ----------
- run:
name: 构建 Tauri 桌面应用
command: |
source ~/.bashrc
pnpm tauri build 2>&1
# ---------- 签名更新包 (可选) ----------
- run:
name: 签名更新构件
condition:
- exists: $TAURI_SIGNING_KEY
- exists: $TAURI_SIGNING_PASSWORD
command: |
source ~/.bashrc
BUNDLE_DIR="src-tauri/target/release/bundle"
APPIMAGE=$(ls "$BUNDLE_DIR/appimage/"*.AppImage 2>/dev/null | head -1)
if [ -n "$APPIMAGE" ]; then
echo "签名 AppImage: $APPIMAGE"
echo "$TAURI_SIGNING_KEY" | base64 -d > /tmp/signing.key
pnpm tauri signer sign \
-k /tmp/signing.key \
-p "$TAURI_SIGNING_PASSWORD" \
"$APPIMAGE"
rm -f /tmp/signing.key
fi
# ---------- 上传构建产物 ----------
- artifacts:
name: Linux AppImage 安装包
paths:
- src-tauri/target/release/bundle/appimage/*.AppImage
- src-tauri/target/release/bundle/appimage/*.AppImage.tar.gz
- src-tauri/target/release/bundle/appimage/*.sig
- src-tauri/target/release/bundle/appimage/*.sig.tar.gz
# ── 阶段 3:发布 (仅标签触发) ──────────────────────────────────────
release:
needs: [build-linux]
condition:
- startsWith: .tag
jobs:
release-job:
steps:
- checkout: {}
- run:
name: 生成更新 JSON
command: |
VERSION="${GIT_TAG#v}"
echo "{\"version\":\"$VERSION\",\"notes\":\"MQTTX $VERSION 发布\",\"pub_date\":\"$(date -u +%Y-%m-%dT%H:%M:%SZ)\",\"platforms\":{}}" > update.json
echo "更新 JSON 已生成"
- artifacts:
name: 更新元数据
paths:
- update.json