147 lines
4.2 KiB
YAML
147 lines
4.2 KiB
YAML
name: Dev Build
|
||
|
||
on:
|
||
push:
|
||
branches:
|
||
- '**'
|
||
tags-ignore:
|
||
- 'v*'
|
||
|
||
jobs:
|
||
cleanup:
|
||
runs-on: ubuntu-latest
|
||
permissions:
|
||
actions: write
|
||
contents: read
|
||
steps:
|
||
- name: Delete old artifacts
|
||
uses: actions/github-script@v8
|
||
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++;
|
||
}
|
||
|
||
typecheck:
|
||
runs-on: ubuntu-latest
|
||
permissions:
|
||
contents: read
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v6
|
||
|
||
- name: Setup pnpm
|
||
uses: pnpm/action-setup@v6
|
||
with:
|
||
version: 10.28.0
|
||
run_install: false
|
||
|
||
- name: Setup Node.js
|
||
uses: actions/setup-node@v6
|
||
with:
|
||
node-version: '22'
|
||
cache: 'pnpm'
|
||
|
||
- name: Install dependencies
|
||
run: pnpm install --frozen-lockfile
|
||
|
||
# Runs `tsc --noEmit` (or `tsc -b`) in every workspace package that
|
||
# exposes a `typecheck` script. Platform-independent, so a single
|
||
# ubuntu runner is sufficient.
|
||
- name: Type check all packages
|
||
run: pnpm typecheck
|
||
|
||
build:
|
||
needs: [cleanup, typecheck]
|
||
permissions:
|
||
contents: read
|
||
strategy:
|
||
fail-fast: false
|
||
matrix:
|
||
include:
|
||
- name: win-x64
|
||
os: windows-latest
|
||
target: win32-x64
|
||
- name: linux-x64
|
||
os: ubuntu-latest
|
||
target: linux-x64
|
||
- name: linux-arm64
|
||
os: ubuntu-24.04-arm
|
||
target: linux-arm64
|
||
runs-on: ${{ matrix.os }}
|
||
steps:
|
||
- name: Checkout
|
||
uses: actions/checkout@v6
|
||
|
||
- name: Setup pnpm
|
||
uses: pnpm/action-setup@v6
|
||
with:
|
||
version: 10.28.0
|
||
run_install: false
|
||
|
||
- name: Setup Node.js
|
||
uses: actions/setup-node@v6
|
||
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
|
||
env:
|
||
SNOWLUMA_TARGET: ${{ matrix.target }}
|
||
run: pnpm run build:all
|
||
|
||
- name: Bundle runtime dependencies
|
||
working-directory: dist
|
||
run: npm install --omit=dev
|
||
|
||
# Naming convention:
|
||
# SnowLuma-dev-<arch>.zip|tar.gz – zero-install (node bundled)
|
||
# SnowLuma-dev-<arch>-lite.zip|tar.gz – user provides Node >= 22
|
||
- name: Package (windows)
|
||
if: matrix.os == 'windows-latest'
|
||
shell: pwsh
|
||
run: |
|
||
Compress-Archive -Path "dist\*" -DestinationPath "SnowLuma-dev-${{ matrix.name }}-lite.zip"
|
||
Copy-Item (Get-Command node).Source -Destination "dist\node.exe"
|
||
Compress-Archive -Path "dist\*" -DestinationPath "SnowLuma-dev-${{ matrix.name }}.zip"
|
||
|
||
- name: Package (linux)
|
||
if: startsWith(matrix.os, 'ubuntu')
|
||
run: |
|
||
chmod +x dist/launcher.sh
|
||
tar -czf "SnowLuma-dev-${{ matrix.name }}-lite.tar.gz" -C dist .
|
||
cp "$(command -v node)" dist/node
|
||
chmod +x dist/node
|
||
tar -czf "SnowLuma-dev-${{ matrix.name }}.tar.gz" -C dist .
|
||
|
||
# Single upload step — glob picks up both variants (.zip on Windows,
|
||
# .tar.gz on Linux) for this matrix row.
|
||
- name: Upload artifacts
|
||
uses: actions/upload-artifact@v7
|
||
with:
|
||
name: SnowLuma-dev-${{ github.sha }}-${{ matrix.name }}
|
||
path: SnowLuma-dev-${{ matrix.name }}*
|
||
retention-days: 3
|
||
overwrite: true
|
||
if-no-files-found: error
|