Files
SnowLuma/.github/workflows/dev-build.yml
T
手瓜一十雪 b6341145be CI: build WebUI and publish node/no-node zips
Simplify CI by removing job matrices and always building the WebUI flavor. Both dev and release workflows now run build:all, verify the websocket native module, and produce two archives: a zero-install bundle that includes node.exe and a no-node variant (requires Node >=22). Artifact names and upload steps were adjusted (dev uses SHA-based names; release uses tag-based names), and release notes were updated to document the two packages and WebUI defaults.
2026-05-03 15:56:19 +08:00

103 lines
3.1 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.
name: Dev Build
on:
push:
branches:
- '**'
tags-ignore:
- 'v*'
jobs:
build:
runs-on: windows-latest
permissions:
actions: write
contents: read
steps:
- name: Delete old artifacts
uses: actions/github-script@v7
with:
script: |
let page = 1;
while (true) {
const { data: { artifacts } } = await github.rest.actions.listArtifactsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
per_page: 100,
page,
});
if (artifacts.length === 0) break;
for (const artifact of artifacts) {
await github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
});
console.log(`Deleted artifact: ${artifact.name}`);
}
page++;
}
- name: Checkout
uses: actions/checkout@v4
- 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 artifacts:
# * SnowLuma-dev.zip – full bundle, ships node.exe (zero-install)
# * SnowLuma-dev-no-node.zip – same bundle without node.exe (user provides Node >= 22)
- name: Package artifact (no-node)
shell: pwsh
run: |
Compress-Archive -Path "dist\*" -DestinationPath "SnowLuma-dev-no-node.zip"
- name: Package artifact (with node.exe)
shell: pwsh
run: |
Copy-Item (Get-Command node).Source -Destination "dist\node.exe"
Compress-Archive -Path "dist\*" -DestinationPath "SnowLuma-dev.zip"
- name: Upload artifact (with node.exe)
uses: actions/upload-artifact@v4
with:
name: SnowLuma-dev-${{ github.sha }}
path: SnowLuma-dev.zip
retention-days: 3
overwrite: true
- name: Upload artifact (no-node)
uses: actions/upload-artifact@v4
with:
name: SnowLuma-dev-${{ github.sha }}-no-node
path: SnowLuma-dev-no-node.zip
retention-days: 3
overwrite: true