mirror of
https://github.com/dream-pep/koring-launcher.git
synced 2026-09-12 05:45:18 +08:00
- 配置electron-builder仅使用SHA256算法签名,避免双签名以减半配额消耗 - 为签名脚本添加配额耗尽处理,超出后跳过后续签名任务 - 新增仅签名主安装包选项和发布工作流签名开关 - 在发布笔记中添加签名状态展示 - 更新自动更新文档,补充SignPath配额问题及解决方案
141 lines
5.8 KiB
YAML
141 lines
5.8 KiB
YAML
# Koring Launcher 构建 & 发布流水线(手动触发):构建 → SignPath 签名 → 发布 GitHub Release
|
||
#
|
||
# 手动触发(Actions 页面 -> Run workflow):
|
||
# mode 选择构建模式:beta(测试)或 run(正式)
|
||
# version 基础版本号,如 1.2.0
|
||
# 自动生成 BUILD ID(Action 运行的 UTC 时刻,格式 YYMMDDHHMM,如 2608280224),
|
||
# 最终版本号 = {version}-{BUILD ID}(如 1.2.0-2608280224),tag = v{version}-{BUILD ID}。
|
||
#
|
||
# 发布行为:
|
||
# - beta:创建 GitHub prerelease(不占用 "Latest" 位)
|
||
# - run :创建正式 release
|
||
# - Release 正文为中文:版本信息(当前版本 / 编译状态)+ 自上个 release tag 以来的提交记录(默认折叠)
|
||
# - 上传产物:koring-launcher-{version}-{BUILD ID}-setup.exe + latest.yml(electron-updater 更新清单)
|
||
#
|
||
# Secrets:
|
||
# SIGNPATH_API_TOKEN SignPath API Token(必填;放在 Environment "BUILDER" 的环境 Secrets 中)
|
||
# SIGNPATH_ARTIFACT_CONFIG_SLUG 产物配置 slug(项目只有一个配置时可留空;仓库级 Secret)
|
||
#
|
||
# 组织 ID / slug 非密钥,直接写在下方 env(SignPath 后台确认值):
|
||
# OrganizationId 31ecd033-d59e-492b-a70b-b00a54bbc7c2
|
||
# ProjectSlug Koring_Launcher
|
||
# SigningPolicySlug Koring_Launcher_Dev_builder
|
||
#
|
||
# ⚠️ 签名策略说明:
|
||
# - 审批流程:SignPath 后台已关闭人工审批(自动批准),CI 可全自动。
|
||
# - 证书:当前策略为测试证书,用户机器默认不信任(SmartScreen / 杀软警告),
|
||
# 正式对外发布需生产证书(OV/EV)+ 对应生产签名策略,届时只换 SIGNPATH_SIGNING_POLICY_SLUG。
|
||
#
|
||
# ⚠️ 版本号注意(electron-updater 语义):
|
||
# - {version}-{BUILD ID} 属于 semver prerelease;已安装同格式版本的用户可正常收到更高 BUILD ID 的更新。
|
||
# - 若未来发布不带 BUILD ID 的稳定版本(如 1.2.0),稳定版用户不会自动升级到带 BUILD ID 的构建。
|
||
|
||
name: BUILD & Release (SignPath)
|
||
|
||
on:
|
||
workflow_dispatch:
|
||
inputs:
|
||
mode:
|
||
description: '构建模式:beta(测试)/ run(正式)'
|
||
required: true
|
||
type: choice
|
||
options:
|
||
- beta
|
||
- run
|
||
version:
|
||
description: '基础版本号,如 1.2.0'
|
||
required: true
|
||
default: '1.2.0'
|
||
sign:
|
||
description: '是否使用 SignPath 签名(配额不足时自动跳过)'
|
||
required: true
|
||
type: boolean
|
||
default: true
|
||
|
||
permissions:
|
||
contents: write
|
||
|
||
jobs:
|
||
build-sign-publish:
|
||
runs-on: windows-latest
|
||
# 声明使用 Environment "BUILDER",才能读取其中的环境 Secret SIGNPATH_API_TOKEN
|
||
environment: BUILDER
|
||
env:
|
||
# 勾选 sign 才注入 token 走 SignPath 签名;不勾选则 token 为空,模块自动跳过签名
|
||
SIGNPATH_API_TOKEN: ${{ inputs.sign && secrets.SIGNPATH_API_TOKEN || '' }}
|
||
SIGNPATH_ORG_ID: 31ecd033-d59e-492b-a70b-b00a54bbc7c2
|
||
SIGNPATH_PROJECT_SLUG: Koring_Launcher
|
||
SIGNPATH_SIGNING_POLICY_SLUG: Koring_Launcher_Dev_builder
|
||
SIGNPATH_ARTIFACT_CONFIG_SLUG: ${{ secrets.SIGNPATH_ARTIFACT_CONFIG_SLUG }}
|
||
# 内部测试阶段:SignPath 年度配额(约 500MB)耗尽时跳过签名、照常发布(产物未签名)。
|
||
# ⚠️ 正式发布请删除此行并升级 SignPath 套餐(同时建议 SIGNPATH_ONLY_INSTALLER=false 全量签名)。
|
||
SIGNPATH_SKIP_ON_QUOTA: 'true'
|
||
steps:
|
||
- uses: actions/checkout@v4
|
||
with:
|
||
# 需要完整历史:生成中文提交记录(自上个 release tag 以来)
|
||
fetch-depth: 0
|
||
|
||
- uses: pnpm/action-setup@v4
|
||
with:
|
||
version: 11.7.0
|
||
|
||
- uses: actions/setup-node@v4
|
||
with:
|
||
node-version: 22
|
||
cache: pnpm
|
||
|
||
- name: Install dependencies
|
||
run: pnpm install --frozen-lockfile
|
||
|
||
# BUILD ID = Action 运行时刻(UTC, YYMMDDHHMM),如 2608280224
|
||
- name: Generate BUILD ID & set version
|
||
id: version
|
||
shell: pwsh
|
||
run: |
|
||
$buildId = [DateTime]::UtcNow.ToString('yyMMddHHmm')
|
||
$full = "${{ inputs.version }}-$buildId"
|
||
node scripts/version.js $full
|
||
"build_id=$buildId" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
|
||
"full=$full" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
|
||
Write-Host "BUILD ID: $buildId -> version: $full"
|
||
|
||
- name: Build renderer + main (${{ inputs.mode }})
|
||
shell: pwsh
|
||
run: |
|
||
if ("${{ inputs.mode }}" -eq "beta") {
|
||
pnpm build:beta
|
||
pnpm icon:beta
|
||
} else {
|
||
pnpm build:run
|
||
pnpm icon:run
|
||
}
|
||
|
||
# 关键步骤:win.sign 自定义签名(SignPath)在打包过程中逐个签名内部 exe 与 setup.exe
|
||
- name: Package & sign (SignPath)
|
||
run: pnpm exec electron-builder --win --publish never
|
||
|
||
- name: Generate Chinese release notes
|
||
shell: pwsh
|
||
run: |
|
||
./scripts/release-notes.ps1 `
|
||
-BaseVersion "${{ inputs.version }}" `
|
||
-FullVersion "${{ steps.version.outputs.full }}" `
|
||
-Mode "${{ inputs.mode }}" `
|
||
-SigningStatus "${{ inputs.sign && '已签名' || '未签名' }}" `
|
||
-OutputPath release-notes.md
|
||
|
||
- name: Publish GitHub Release
|
||
shell: pwsh
|
||
env:
|
||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||
run: |
|
||
$tag = "v${{ steps.version.outputs.full }}"
|
||
$prerelease = if ("${{ inputs.mode }}" -eq "beta") { "--prerelease" } else { "" }
|
||
gh release create $tag `
|
||
"dist-electron/koring-launcher-${{ steps.version.outputs.full }}-setup.exe" `
|
||
"dist-electron/latest.yml" `
|
||
--title "Koring Launcher Releases ${{ inputs.version }}" `
|
||
--notes-file release-notes.md `
|
||
$prerelease
|