name: Release # Builds the branded native installer on EACH OS (so you don't need to own all # three machines) and attaches them to the GitHub Release. Triggers when you push # a version tag, e.g. git tag v2.3.0 && git push --tags on: push: tags: ["v*"] workflow_dispatch: {} # also runnable by hand from the Actions tab permissions: contents: write # needed to create/update the Release jobs: build: strategy: fail-fast: false matrix: # macOS twice on purpose: macos-15 runners are Apple Silicon (arm64), # macos-15-intel are Intel (x86_64) — one DMG per architecture, arch-suffixed # by build.py. (macos-13 was retired: its 2.4.0 job sat queued for hours.) os: [windows-latest, macos-15, macos-15-intel, ubuntu-latest] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 with: fetch-depth: 0 # full history so `git archive` works - uses: actions/setup-python@v5 with: python-version: "3.12" - uses: actions/setup-node@v4 with: node-version: "20" - name: Install PyInstaller + pywebview run: python -m pip install --upgrade pip pyinstaller pywebview - name: Install WebKitGTK for pywebview (Linux) if: runner.os == 'Linux' run: | sudo apt-get update sudo apt-get install -y python3-gi gir1.2-gtk-3.0 gir1.2-webkit2-4.1 libgirepository1.0-dev - name: Install appimagetool (Linux) if: runner.os == 'Linux' # AppImage/appimagetool (maintained), NOT the archived AppImageKit: # its static runtime means the produced AppImage does not need libfuse2 — # which Ubuntu 22.04+ no longer ships, i.e. this is what makes the # AppImage actually run on current distros. run: | sudo curl -L -o /usr/local/bin/appimagetool \ https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage sudo chmod +x /usr/local/bin/appimagetool echo "APPIMAGE_EXTRACT_AND_RUN=1" >> "$GITHUB_ENV" - name: Build native installer run: python installers/native/build.py - name: Build ready-to-run source zip (Linux only) if: runner.os == 'Linux' shell: bash run: | VER=$(python -c "import re;print(re.search(r'__version__\s*=\s*\"([^\"]+)\"', open('namma_agent/version.py').read()).group(1))") mv installers/native/build/app "installers/native/build/Namma-Agent-$VER" (cd installers/native/build && zip -qr "../dist/Namma-Agent-$VER.zip" "Namma-Agent-$VER") - name: Upload installers to the Release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 with: files: installers/native/dist/* # The notes are written by ONE job: every matrix job used to append them, so the # 2.4.0 notes repeated "Which file do I download?" four times. - name: Write the release notes (once) if: startsWith(github.ref, 'refs/tags/') && matrix.os == 'ubuntu-latest' uses: softprops/action-gh-release@v2 with: generate_release_notes: true append_body: true body: | **Which file do I download?** - **Windows desktop app (recommended)** → `NammaAgentSetup-.exe` — installs the native app (no admin needed); updates itself from later releases - **Windows (classic installer)** → `NammaAgentInstaller-.exe` - **Mac (Apple Silicon — M1 and later)** → `NammaAgent--arm64.dmg` - **Mac (Intel)** → `NammaAgent--x86_64.dmg` - **Linux** → `NammaAgentInstaller--x86_64.AppImage` (`chmod +x`, then run — no libfuse2 needed), or the source zip - **Android phone** → `NammaAgent-.apk` — the native app; link it to your computer or a hosted agent, or run the agent on the phone itself ([guide](https://github.com/SanthoshReddy352/Namma-Agent/blob/main/docs/REMOTE_ACCESS.md)) - **Server/VPS** → skip the installers: [one-line install](https://github.com/SanthoshReddy352/Namma-Agent/blob/main/docs/DEPLOY.md) (it fetches `namma-agent-webui--.tar.gz` itself — no need to download it) *macOS note: the app isn't code-signed yet. If macOS blocks it, right-click → Open, or approve it under System Settings → Privacy & Security.* - name: Upload installers as build artifacts (manual runs) if: "!startsWith(github.ref, 'refs/tags/')" uses: actions/upload-artifact@v4 with: name: namma-agent-installer-${{ matrix.os }} path: installers/native/dist/* # The built web UI for server installs (2.4.1). deploy/install.sh downloads # namma-agent-webui--.tar.gz when its checkout's namma_agent/webui tree # hash matches , so a 1 GB VPS skips the hour-long, swap-bound Vite build. webui: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: "22" - name: Build the web UI working-directory: namma_agent/webui run: npm ci --no-audit --no-fund && npm run build - name: Package it for server installs run: | VER=$(python3 -c "import re;print(re.search(r'__version__\s*=\s*\"([^\"]+)\"', open('namma_agent/version.py').read()).group(1))") TREE=$(git rev-parse HEAD:namma_agent/webui | cut -c1-12) echo "$TREE" > namma_agent/webui/dist/.source-tree ASSET="namma-agent-webui-$VER-$TREE.tar.gz" mkdir -p webui-dist tar -czf "webui-dist/$ASSET" -C namma_agent/webui/dist . (cd webui-dist && sha256sum "$ASSET" > "$ASSET.sha256" && cat "$ASSET.sha256") - name: Upload the web UI to the Release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 with: files: webui-dist/* - name: Upload the web UI as a build artifact (manual runs) if: "!startsWith(github.ref, 'refs/tags/')" uses: actions/upload-artifact@v4 with: name: namma-agent-webui path: webui-dist/* # Phase 9 W3: the Electron desktop app — per-user NSIS installer with the Python # runtime bundled. Uploads the three files electron-updater needs to the # Release: NammaAgentSetup-.exe, its .blockmap, and latest.yml (installed # apps read latest.yml from the newest release to offer the update). desktop: runs-on: windows-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: actions/setup-python@v5 with: python-version: "3.12" - uses: actions/setup-node@v4 with: node-version: "22" - name: Read the version (namma_agent/version.py) id: ver shell: bash run: | VER=$(python -c "import re;print(re.search(r'__version__\s*=\s*\"([^\"]+)\"', open('namma_agent/version.py').read()).group(1))") echo "version=$VER" >> "$GITHUB_OUTPUT" echo "Building Namma Agent desktop $VER" - name: Install the desktop build tools working-directory: desktop run: npm ci - name: Stage the backend, web UI and bundled Python working-directory: desktop run: node scripts/stage.js - name: Build the NSIS installer working-directory: desktop # bash and the long option form: PowerShell split "-c.extraMetadata.version=..." into a # file path, so the 2.4.0 build failed (ENOENT desktop\.extraMetadata.version=2.4.0). shell: bash run: npx electron-builder --win nsis --publish never "--config.extraMetadata.version=${{ steps.ver.outputs.version }}" - name: Upload the desktop installer to the Release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 with: files: | desktop/out/NammaAgentSetup-*.exe desktop/out/NammaAgentSetup-*.exe.blockmap desktop/out/latest.yml - name: Upload the desktop installer as a build artifact (manual runs) if: "!startsWith(github.ref, 'refs/tags/')" uses: actions/upload-artifact@v4 with: name: namma-agent-desktop-windows path: | desktop/out/NammaAgentSetup-*.exe desktop/out/NammaAgentSetup-*.exe.blockmap desktop/out/latest.yml # Phase 8: the Android app — a release APK attached to the same Release. # Signed with your keystore when the ANDROID_KEYSTORE_* secrets are set # (see mobile/android/README.md); otherwise signed with a throwaway debug key # so it still installs (updates then need an uninstall first). android: runs-on: ubuntu-latest defaults: run: working-directory: mobile/android steps: - uses: actions/checkout@v4 - uses: actions/setup-java@v4 with: distribution: temurin java-version: "21" - uses: gradle/actions/setup-gradle@v4 - name: Read the version (namma_agent/version.py) id: ver working-directory: . run: | VER=$(python3 -c "import re;print(re.search(r'__version__\s*=\s*\"([^\"]+)\"', open('namma_agent/version.py').read()).group(1))") echo "version=$VER" >> "$GITHUB_OUTPUT" - name: Release keystore (from secrets, if configured) env: KEYSTORE_B64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }} KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }} run: | if [ -n "$KEYSTORE_B64" ]; then echo "$KEYSTORE_B64" | base64 -d > release.jks { echo "storeFile=release.jks" echo "storePassword=$KEYSTORE_PASSWORD" echo "keyAlias=$KEY_ALIAS" echo "keyPassword=$KEY_PASSWORD" } > keystore.properties echo "Signing with the release keystore." else echo "::warning::ANDROID_KEYSTORE_BASE64 is not set — the APK is signed with a debug key." fi - name: Unit + screen tests run: | chmod +x gradlew ./gradlew --no-daemon testDebugUnitTest - name: Build the release APK run: | ./gradlew --no-daemon assembleRelease -PnammaVersion=${{ steps.ver.outputs.version }} mkdir -p dist cp app/build/outputs/apk/release/app-release.apk "dist/NammaAgent-${{ steps.ver.outputs.version }}.apk" - name: Upload the APK to the Release if: startsWith(github.ref, 'refs/tags/') uses: softprops/action-gh-release@v2 with: files: mobile/android/dist/NammaAgent-*.apk - name: Upload the APK as a build artifact (manual runs) if: "!startsWith(github.ref, 'refs/tags/')" uses: actions/upload-artifact@v4 with: name: namma-agent-android path: mobile/android/dist/*.apk