Files
SnowLuma/.github/workflows/release.yml
T
手瓜一十雪 02326b0968 CI: generate release notes and full fetch
Set checkout fetch-depth to 0 and add a PowerShell step that generates release-notes.md for the current tag (computes previous tag, collects commit messages, and emits localized download/usage notes for Windows x64 builds). Update the GitHub Release step to use body_path: release-notes.md and overwrite_files: true (replacing auto-generated notes) so the release includes the curated changelog and artifact information.
2026-05-02 20:23:45 +08:00

103 lines
3.0 KiB
YAML

name: Build and Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- name: "win-x64"
script: "build"
- name: "win-x64-webui"
script: "build:all"
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.28.0
run_install: false
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build project
run: pnpm run ${{ matrix.script }}
- name: Verify native files
shell: pwsh
run: |
if (!(Test-Path "dist\native\snowluma-win32-x64.node")) { throw "Missing dist\native\snowluma-win32-x64.node" }
if (!(Test-Path "dist\native\snowluma-win32-x64.dll")) { throw "Missing dist\native\snowluma-win32-x64.dll" }
- name: Bundle runtime dependencies
working-directory: dist
run: npm install --omit=dev
- name: Package release
shell: pwsh
run: |
Copy-Item (Get-Command node).Source -Destination "dist\node.exe"
Compress-Archive -Path "dist\*" -DestinationPath "SnowLuma-${{ github.ref_name }}-${{ matrix.name }}.zip"
- name: Generate release note
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
$previousTag = git describe --tags --abbrev=0 "$tag^" 2>$null
if ($LASTEXITCODE -ne 0) { $previousTag = "" }
if ($previousTag) {
$range = "$previousTag..$tag"
$changes = git log --pretty=format:"- %s (%h)" $range
} else {
$changes = git log --pretty=format:"- %s (%h)" $tag
}
if (!$changes) { $changes = "- No commit changes detected." }
$body = @"
# SnowLuma $tag
## 发布概览
本次发布提供 SnowLuma 的 Windows x64 构建产物。
## 下载说明
- ``SnowLuma-$tag-win-x64.zip``:核心运行时版本。
- ``SnowLuma-$tag-win-x64-webui.zip``:包含 WebUI 静态资源的完整版本。
## 更新内容
$changes
## 使用说明
- 仅支持 Windows x64 环境。
- 压缩包内已包含 ``node.exe`` 与运行时依赖。
- 如需在浏览器中选择进程、调整配置或查看日志,请使用 WebUI 版本。
"@
$body -replace "(?m)^ ", "" | Set-Content -Path "release-notes.md" -Encoding utf8
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: SnowLuma-*.zip
body_path: release-notes.md
overwrite_files: true
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}