# Release build for the community edition (P1.3d). # # On each release target the build job stages the sidecar payload, packs the # server archive for the installer (ADR-0009), builds the desktop installers, # smoke-tests the installer and the desktop app, and uploads everything as a # workflow artifact. A pushed v* tag also gets a draft GitHub release with a # SHA256SUMS file. Pull requests and manual runs build and test only. # # Nothing is signed or notarized, and the only secret is GITHUB_TOKEN. The # macOS app gets an ad-hoc signature ("-"), which needs no certificate: without # one, macOS reports a downloaded Apple Silicon app as damaged. name: Release on: push: tags: - 'v*' pull_request: branches: - main paths: - 'app/**' - 'apps/web/**' - 'packages/**' - 'scripts/**' - 'package.json' - 'package-lock.json' - '.github/workflows/release.yml' workflow_dispatch: permissions: contents: read concurrency: group: release-${{ github.ref }} cancel-in-progress: ${{ github.event_name == 'pull_request' }} env: # The embedding model runs on CPU; skip the CUDA download on Linux (ADR-0008). ONNXRUNTIME_NODE_INSTALL_CUDA: skip jobs: build: name: Build (${{ matrix.release_target }}) strategy: fail-fast: false matrix: include: - runner: windows-latest rust_target: x86_64-pc-windows-msvc release_target: windows-x64 arch: x64 bundles: nsis,msi - runner: macos-15 rust_target: aarch64-apple-darwin release_target: macos-arm64 arch: arm64 bundles: app,dmg - runner: macos-15-intel rust_target: x86_64-apple-darwin release_target: macos-x64 arch: x64 bundles: app,dmg - runner: ubuntu-22.04 rust_target: x86_64-unknown-linux-gnu release_target: linux-x64 arch: x64 bundles: deb,appimage runs-on: ${{ matrix.runner }} timeout-minutes: 120 env: # The staging scripts take the Node runtime and native modules for this architecture. TARGET_ARCH: ${{ matrix.arch }} steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 with: persist-credentials: false # The Node version the installer and the desktop app ship (ADR-0008). - name: Setup Node.js uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 with: node-version: 22.23.2 cache: npm cache-dependency-path: | package-lock.json app/package-lock.json - name: Verify runner architecture run: node -e "if (process.arch !== process.env.TARGET_ARCH) { console.error('Expected ' + process.env.TARGET_ARCH + ' runner, got ' + process.arch); process.exit(1); }" - name: Setup Rust uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 with: toolchain: 1.94.0 targets: ${{ matrix.rust_target }} - name: Rust cache uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 with: workspaces: app/src-tauri key: ${{ matrix.rust_target }} # Tauri 2 build dependencies, plus Xvfb and D-Bus for the desktop smoke test. - name: Install Linux system packages if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev \ libxdo-dev libssl-dev patchelf file xdg-utils xvfb dbus - name: Install dependencies run: npm ci - name: Install locked Tauri CLI run: npm ci --prefix app --ignore-scripts # The staged sidecar carries the dist/ builds of the workspace packages. - name: Build packages run: npm run build:packages - name: Build installer run: npm run build --workspace @waggle-ai/waggle # On Windows these steps run in PowerShell, the default shell, where tar # is the system bsdtar that bundle-node and build-server-archive expect. - name: Bundle Node.js runtime run: node scripts/bundle-node.mjs - name: Build sidecar run: node scripts/build-sidecar.mjs - name: Bundle native dependencies run: node scripts/bundle-native-deps.mjs - name: Stage sidecar dependencies run: node scripts/stage-sidecar-deps.mjs - name: Check sidecar resources run: node scripts/check-sidecar-resources.mjs - name: Build web UI run: cd apps/web && npx vite build - name: Build server archive run: node scripts/build-server-archive.mjs # Install, doctor, run on a free port with a temporary data directory, # wait for /health, stop, uninstall. - name: Installer smoke test timeout-minutes: 15 run: node scripts/release-smoke.mjs installer - name: Build desktop app if: runner.os != 'macOS' run: cd app && node node_modules/@tauri-apps/cli/tauri.js build --target ${{ matrix.rust_target }} --bundles "${{ matrix.bundles }}" - name: Build desktop app (macOS, ad-hoc signature) if: runner.os == 'macOS' run: cd app && node node_modules/@tauri-apps/cli/tauri.js build --target ${{ matrix.rust_target }} --bundles "${{ matrix.bundles }}" --config '{"bundle":{"macOS":{"signingIdentity":"-"}}}' # Each desktop smoke test starts the packaged app, waits until its sidecar # answers /health on 127.0.0.1:3333, then stops the app and the sidecar. - name: Desktop smoke test (Windows) if: runner.os == 'Windows' timeout-minutes: 15 run: | $setup = Get-ChildItem app/src-tauri/target/${{ matrix.rust_target }}/release/bundle/nsis/*-setup.exe | Select-Object -First 1 $installDir = Join-Path $env:RUNNER_TEMP 'waggle-desktop' # A silent per-user install into a temporary directory. $installer = Start-Process -FilePath $setup.FullName -ArgumentList '/S', "/D=$installDir" -Wait -PassThru if ($installer.ExitCode -ne 0) { throw "The NSIS installer exited with code $($installer.ExitCode)" } $app = Get-ChildItem -LiteralPath $installDir -Filter *.exe | Where-Object { $_.Name -notlike 'uninstall*' } | Select-Object -First 1 if (-not $app) { throw "No app executable in $installDir" } node scripts/release-smoke.mjs desktop --app $app.FullName - name: Desktop smoke test (macOS) if: runner.os == 'macOS' timeout-minutes: 15 run: node scripts/release-smoke.mjs desktop --app app/src-tauri/target/${{ matrix.rust_target }}/release/bundle/macos/Waggle.app - name: Desktop smoke test (Linux) if: runner.os == 'Linux' timeout-minutes: 15 env: # WebKitGTK has no GPU compositing under Xvfb. WEBKIT_DISABLE_COMPOSITING_MODE: '1' run: | deb=$(ls app/src-tauri/target/${{ matrix.rust_target }}/release/bundle/deb/*.deb) sudo apt-get install -y "$PWD/$deb" app=$(dpkg-deb --contents "$deb" | awk '$1 ~ /^-/ && $6 ~ /^\.\/usr\/bin\// { print substr($6, 2); exit }') xvfb-run --auto-servernum dbus-run-session -- node scripts/release-smoke.mjs desktop --app "$app" - name: Collect installers shell: bash run: | bundle=app/src-tauri/target/${{ matrix.rust_target }}/release/bundle case "$RUNNER_OS" in Windows) cp "$bundle"/nsis/*-setup.exe "$bundle"/msi/*.msi artifacts/ ;; macOS) cp "$bundle"/dmg/*.dmg artifacts/ ;; Linux) cp "$bundle"/deb/*.deb "$bundle"/appimage/*.AppImage artifacts/ ;; esac ls -l artifacts - name: Upload build outputs uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 with: name: waggle-${{ matrix.release_target }} path: artifacts/ if-no-files-found: error retention-days: 14 publish: name: Draft GitHub release needs: build if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') runs-on: ubuntu-22.04 timeout-minutes: 30 permissions: contents: write steps: - name: Download build outputs uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 with: pattern: waggle-* path: release merge-multiple: true # The installer downloads release v, and the desktop # installers carry the app version. Warn when the tag differs from either. - name: Check versions env: TAG: ${{ github.ref_name }} run: | version="${TAG#v}" compgen -G "release/waggle-server-$version-*.tar.gz" > /dev/null \ || echo "::warning::No server archive for $TAG: packages/launcher/package.json has another version." compgen -G "release/Waggle_${version}_*" > /dev/null \ || echo "::warning::No desktop installer for $TAG: app/src-tauri/tauri.conf.json has another version." - name: Write SHA256SUMS working-directory: release run: | find . -maxdepth 1 -type f ! -name '*.sha256' -printf '%f\n' | LC_ALL=C sort | xargs -d '\n' sha256sum > SHA256SUMS cat SHA256SUMS - name: Create draft release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_REPO: ${{ github.repository }} TAG: ${{ github.ref_name }} run: gh release create "$TAG" release/* --draft --verify-tag --title "Waggle $TAG" --generate-notes