Files
koring-launcher/.github/workflows/release.yml
T
dream_pep 30451d505c ci(release): 重构发布流水线,新增中文发布说明脚本,更新文档
重构GitHub Actions发布流水线:
- 改为手动触发,支持beta测试和正式发布两种模式
- 自动基于UTC时刻生成BUILD ID作为版本后缀
- 拆分打包签名与发布步骤,新增中文发布说明生成逻辑
新增scripts/release-notes.ps1脚本,用于生成带提交记录的中文发布说明
更新docs/auto-update-plan.md文档,适配新的发布流程并新增对应章节
2026-08-28 02:33:47 +08:00

131 lines
5.2 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.
# Koring Launcher 构建 & 发布流水线(手动触发):构建 → SignPath 签名 → 发布 GitHub Release
#
# 手动触发(Actions 页面 -> Run workflow):
# mode 选择构建模式:beta(测试)或 run(正式)
# version 基础版本号,如 1.2.0
# 自动生成 BUILD IDAction 运行的 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.ymlelectron-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'
permissions:
contents: write
jobs:
build-sign-publish:
runs-on: windows-latest
# 声明使用 Environment "BUILDER",才能读取其中的环境 Secret SIGNPATH_API_TOKEN
environment: BUILDER
env:
SIGNPATH_API_TOKEN: ${{ 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 }}
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 }}" `
-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