name: Build and Release on: push: tags: - 'v*' permissions: contents: write jobs: build: 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 # Always builds the WebUI flavor — no separate "core-only" artifact. - name: Build project run: pnpm run build:all - 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" } if (!(Test-Path "dist\native\websocket-win32-x64.node")) { throw "Missing dist\native\websocket-win32-x64.node" } - name: Bundle runtime dependencies working-directory: dist run: npm install --omit=dev # Two release archives: # * SnowLuma--win-x64.zip – zero-install bundle (ships node.exe) # * SnowLuma--win-x64-no-node.zip – same bundle without node.exe - name: Package release (no-node) shell: pwsh run: | Compress-Archive -Path "dist\*" -DestinationPath "SnowLuma-${{ github.ref_name }}-win-x64-no-node.zip" - name: Package release (with node.exe) shell: pwsh run: | Copy-Item (Get-Command node).Source -Destination "dist\node.exe" Compress-Archive -Path "dist\*" -DestinationPath "SnowLuma-${{ github.ref_name }}-win-x64.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 构建产物,默认包含 WebUI。 ## 下载说明 - ``SnowLuma-$tag-win-x64.zip``:完整版本,内置 ``node.exe`` 与运行时依赖,解压即可使用。 - ``SnowLuma-$tag-win-x64-no-node.zip``:不含 ``node.exe``,需自行安装 Node.js 22 及以上版本后再运行 ``launcher.bat`` 或 ``node index.mjs``。 ## 更新内容 $changes ## 使用说明 - 仅支持 Windows x64 环境。 - 两个压缩包均已内置 WebUI 静态资源;启动后访问 http://localhost:8080 选择进程、调整配置或查看日志。 - ``no-node`` 版本要求系统 ``node`` 可执行文件版本 >= 22。 "@ $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, '-') }}