Restructure the repository into a pnpm workspace under packages/ (core, webui, runtime). Move source files for core and webui into packages/*, add package manifests for @snowluma/core and @snowluma/runtime, and remove the old launcher package.json. Update root package.json to be a monorepo controller (scripts delegate to pnpm filters, set packageManager and Node engine). Configure build outputs to emit into the repo-root dist/ (vite config changes) so the existing release pipeline continues to work. Add .npmrc with mirrors, expand .gitignore for monorepo layout, add tsconfig base and package-level tsconfigs, and add vitest config for the core package. Adjust injector native search paths and update tests import paths to the new package layout. Small CI/workflow comment added to clarify build behavior and README updated with monorepo structure and common commands.
104 lines
3.1 KiB
YAML
104 lines
3.1 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
|
|
|
|
# Root scripts delegate to `moon run`; produces dist/ at repo root.
|
|
- 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, '-') }}
|