name: Build and Release on: push: tags: - 'v*' permissions: contents: write jobs: build: 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 with: fetch-depth: 0 - 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--.zip|tar.gz – zero-install (node bundled) # SnowLuma---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-${{ github.ref_name }}-${{ matrix.name }}-lite.zip" Copy-Item (Get-Command node).Source -Destination "dist\node.exe" Compress-Archive -Path "dist\*" -DestinationPath "SnowLuma-${{ github.ref_name }}-${{ matrix.name }}.zip" - name: Package (linux) if: startsWith(matrix.os, 'ubuntu') run: | chmod +x dist/launcher.sh tar -czf "SnowLuma-${{ github.ref_name }}-${{ matrix.name }}-lite.tar.gz" -C dist . cp "$(command -v node)" dist/node chmod +x dist/node tar -czf "SnowLuma-${{ github.ref_name }}-${{ matrix.name }}.tar.gz" -C dist . - name: Upload build artifacts uses: actions/upload-artifact@v7 with: name: release-${{ matrix.name }} path: SnowLuma-${{ github.ref_name }}-${{ matrix.name }}* if-no-files-found: error retention-days: 1 release: needs: build runs-on: ubuntu-latest steps: - name: Checkout (for git log) uses: actions/checkout@v6 with: fetch-depth: 0 - name: Download all artifacts uses: actions/download-artifact@v7 with: path: artifacts - name: Collect release assets run: | mkdir -p release find artifacts -type f \( -name '*.zip' -o -name '*.tar.gz' \) -exec cp {} release/ \; ls -lh release/ - name: Generate release note shell: bash run: | tag="${GITHUB_REF_NAME}" previousTag="$(git describe --tags --abbrev=0 "${tag}^" 2>/dev/null || true)" if [[ -n "$previousTag" ]]; then changes="$(git log --pretty=format:'- %s (%h)' "$previousTag..$tag")" else changes="$(git log --pretty=format:'- %s (%h)' "$tag")" fi [[ -z "$changes" ]] && changes="- No commit changes detected." cat > release-notes.md <-linux--lite.tar.gz` # asset and bake it into the container. # # Chained as a job dependency rather than via `on: release: published` # because workflows triggered by GITHUB_TOKEN cannot fire downstream # workflow events (GitHub anti-loop safeguard). Doing it as `needs: release` # keeps the dispatch under our PAT. dispatch-docker: needs: release runs-on: ubuntu-latest environment: SnowLuma steps: - name: Trigger Docker.Framework workflow_dispatch uses: actions/github-script@v8 env: RELEASE_REPOSITORY: ${{ vars.DOCKER_RELEASE_REPOSITORY }} DOCKER_IMAGE: ${{ vars.DOCKER_IMAGE }} DOCKER_PLATFORMS: ${{ vars.DOCKER_PLATFORMS }} DOCKER_WORKFLOW: ${{ vars.DOCKER_WORKFLOW }} DOCKER_REF: ${{ vars.DOCKER_REF }} with: github-token: ${{ secrets.SNOWLUMA_TOKEN }} script: | const target = process.env.RELEASE_REPOSITORY; if (!target || !target.includes('/')) { throw new Error('Set SnowLuma environment variable DOCKER_RELEASE_REPOSITORY to owner/repo.'); } const [owner, repo] = target.split('/'); const tag = context.ref.replace('refs/tags/', ''); const sourceRepo = context.repo.owner + '/' + context.repo.repo; const image = process.env.DOCKER_IMAGE || 'motricseven7/snowluma'; const platforms = process.env.DOCKER_PLATFORMS || 'linux/amd64,linux/arm64'; const workflowId = process.env.DOCKER_WORKFLOW || 'docker-image.yml'; const ref = process.env.DOCKER_REF || 'main'; await github.rest.actions.createWorkflowDispatch({ owner, repo, workflow_id: workflowId, ref, inputs: { image, tag, push: 'true', platforms, snowluma_tag: tag, snowluma_repository: sourceRepo, }, }); core.info(`Dispatched ${workflowId}@${ref} on ${target} for SnowLuma release ${sourceRepo}@${tag} (image=${image}, platforms=${platforms}).`);