installerbuilder/examples/plugin-example.yaml

216 lines
5.7 KiB
YAML

# Plugin Example - 插件系统示例配置
# 这个示例展示了如何使用插件系统来扩展安装包构建器的功能
name: "PluginDemoApp"
version: "1.5.0"
description: "An application demonstrating the plugin system"
author: "Plugin Developer"
license: "MIT"
# 构建目标
targets:
- platform: "windows"
arch: "amd64"
packageType: "msi"
outputPath: "dist/windows"
- platform: "linux"
arch: "amd64"
packageType: "deb"
outputPath: "dist/linux"
# 文件 - 指定要包含在安装包中的文件
files:
- source: "bin/app.exe"
destination: "bin/app.exe"
permissions: "0755"
platforms: ["windows"]
- source: "bin/app"
destination: "bin/app"
permissions: "0755"
platforms: ["linux"]
- source: "README.md"
destination: "docs/README.md"
permissions: "0644"
# 目录 - 指定要包含在安装包中的目录
directories:
- source: "assets"
destination: "assets"
permissions: "0755"
recursive: true
# 插件配置
plugins:
# 代码签名插件 - 对Windows可执行文件进行签名
codesign:
enabled: true
windows:
certificatePath: "certs/windows-cert.pfx"
certificatePassword: "${CERT_PASSWORD}" # 从环境变量获取
timestampServer: "http://timestamp.digicert.com"
signTool: "signtool.exe"
macos:
identityName: "Developer ID Application: Your Company (ABCDEF1234)"
keychain: "login.keychain"
keychainPassword: "${KEYCHAIN_PASSWORD}" # 从环境变量获取
# 通知插件 - 构建完成后发送通知
notify:
enabled: true
methods:
# Slack通知
slack:
webhook: "${SLACK_WEBHOOK_URL}" # 从环境变量获取
channel: "#builds"
username: "Installer Builder"
icon: ":package:"
# 邮件通知
email:
smtp:
server: "smtp.example.com"
port: 587
username: "${SMTP_USERNAME}" # 从环境变量获取
password: "${SMTP_PASSWORD}" # 从环境变量获取
useTLS: true
from: "builder@example.com"
to: ["team@example.com"]
subject: "Build Completed: PluginDemoApp ${version}"
# 压缩插件 - 控制压缩级别和算法
compression:
enabled: true
level: "ultra" # 可选: fast, normal, high, ultra
algorithm: "zstd" # 可选: zlib, zstd, lzma
excludePatterns:
- "*.jpg"
- "*.png"
- "*.mp4"
# 自动更新插件 - 配置自动更新功能
autoupdate:
enabled: true
updateUrl: "https://example.com/updates"
checkInterval: "1d" # 1天
channelName: "stable" # 可选: stable, beta, dev
mandatoryVersionRange: ">=1.0.0 <2.0.0"
promptForUpdate: true
# 安装向导插件 - 自定义安装向导
installer-wizard:
enabled: true
theme: "modern" # 可选: classic, modern, dark
steps:
- id: "welcome"
type: "welcome"
title: "欢迎安装 PluginDemoApp"
message: "这个向导将引导您完成安装过程。"
- id: "license"
type: "license"
title: "许可协议"
licenseFile: "LICENSE.txt"
- id: "directory"
type: "directory"
title: "选择安装目录"
defaultDir: "${ProgramFiles}\\PluginDemoApp"
- id: "components"
type: "components"
title: "选择组件"
components:
- id: "core"
name: "核心组件"
description: "必需的核心应用组件"
required: true
selected: true
- id: "docs"
name: "文档"
description: "用户手册和API文档"
required: false
selected: true
- id: "examples"
name: "示例"
description: "示例代码和项目"
required: false
selected: false
- id: "summary"
type: "summary"
title: "准备安装"
message: "点击"安装"开始安装过程。"
- id: "progress"
type: "progress"
title: "正在安装"
message: "正在安装组件,请稍候..."
- id: "finish"
type: "finish"
title: "安装完成"
message: "PluginDemoApp 已成功安装。"
runAfterInstall: true
runCommand: "[INSTALLDIR]bin\\app.exe"
# 本地化插件 - 支持多语言
localization:
enabled: true
defaultLocale: "zh-CN"
locales:
- id: "en-US"
name: "English (US)"
file: "locales/en-US.json"
- id: "zh-CN"
name: "简体中文"
file: "locales/zh-CN.json"
- id: "ja-JP"
name: "日本語"
file: "locales/ja-JP.json"
# 自定义包类型插件 - 使用自定义包类型
custom-package:
enabled: true
type: "appimage" # 自定义包类型
config:
icon: "assets/icon.png"
categories: "Utility;Development"
executablePath: "bin/app"
# 安装前脚本
preInstall:
path: "scripts/pre-install.sh"
type: "shell"
args: ["--check-deps"]
# 安装后脚本
postInstall:
path: "scripts/post-install.sh"
type: "shell"
args: ["--configure"]
# 钩子 - 定义构建过程中的钩子点
hooks:
# 构建前钩子
preBuild:
- name: "检查依赖"
command: "scripts/check-deps.sh"
- name: "生成版本信息"
command: "scripts/generate-version.sh"
# 构建后钩子
postBuild:
- name: "运行测试"
command: "scripts/run-tests.sh"
- name: "生成校验和"
command: "scripts/generate-checksums.sh"
# 包创建前钩子
prePackage:
- name: "优化资源"
command: "scripts/optimize-assets.sh"
# 包创建后钩子
postPackage:
- name: "验证包"
command: "scripts/verify-package.sh"