Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
- "extensions/zalouser/**"
- "docs/channels/zalouser.md"

"app: electron-desktop":
- changed-files:
- any-glob-to-any-file:
- "apps/electron-desktop/**"
"app: android":
- changed-files:
- any-glob-to-any-file:
Expand Down
156 changes: 156 additions & 0 deletions .github/workflows/electron-desktop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
name: Electron Desktop

on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
publish:
description: "Publish to GitHub Releases"
required: false
default: false
type: boolean

# Only allow one release build at a time to avoid race conditions on GitHub Releases.
concurrency:
group: electron-desktop-${{ github.ref }}
cancel-in-progress: true

jobs:
build-macos:
runs-on: macos-14
timeout-minutes: 60

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: false

- name: Checkout submodules (retry)
run: |
set -euo pipefail
git submodule sync --recursive
for attempt in 1 2 3 4 5; do
if git -c protocol.version=2 submodule update --init --force --depth=1 --recursive; then
exit 0
fi
echo "Submodule update failed (attempt $attempt/5). Retrying…"
sleep $((attempt * 10))
done
exit 1

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
check-latest: true

- name: Setup pnpm (corepack retry)
run: |
set -euo pipefail
corepack enable
for attempt in 1 2 3; do
if corepack prepare pnpm@10.23.0 --activate; then
pnpm -v
exit 0
fi
echo "corepack prepare failed (attempt $attempt/3). Retrying..."
sleep $((attempt * 10))
done
exit 1

- name: Runtime versions
run: |
node -v
npm -v
pnpm -v

- name: Install root dependencies
run: pnpm install --frozen-lockfile

- name: Install electron-desktop dependencies
working-directory: apps/electron-desktop
run: npm ci

- name: Build main + renderer
working-directory: apps/electron-desktop
run: npm run build:all

- name: Prepare OpenClaw bundle
working-directory: apps/electron-desktop
run: npm run prepare:openclaw

- name: Prepare Node runtime
working-directory: apps/electron-desktop
run: npm run prepare:node

- name: Prepare jq runtime
working-directory: apps/electron-desktop
run: npm run prepare:jq:all

- name: Prepare gh runtime
working-directory: apps/electron-desktop
run: npm run prepare:gh:all

# GOG credentials require a .env file with secrets; skip if not available.
- name: Prepare GOG runtime
if: env.GOG_CLIENT_EMAIL != ''
working-directory: apps/electron-desktop
run: npm run prepare:gog:all
env:
GOG_CLIENT_EMAIL: ${{ secrets.GOG_CLIENT_EMAIL }}

- name: Prepare memo runtime
working-directory: apps/electron-desktop
run: npm run prepare:memo:all

- name: Prepare remindctl runtime
working-directory: apps/electron-desktop
run: npm run prepare:remindctl:all

- name: Prepare obsidian-cli runtime
working-directory: apps/electron-desktop
run: npm run prepare:obsidian-cli:all

# Determine publish mode: --publish always for tags, --publish never otherwise.
- name: Determine publish mode
id: publish-mode
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "flag=always" >> "$GITHUB_OUTPUT"
elif [[ "${{ inputs.publish }}" == "true" ]]; then
echo "flag=always" >> "$GITHUB_OUTPUT"
else
echo "flag=never" >> "$GITHUB_OUTPUT"
fi

# Build + publish. When CSC_LINK is missing, electron-builder skips signing.
- name: Build with electron-builder
working-directory: apps/electron-desktop
run: npx electron-builder --publish ${{ steps.publish-mode.outputs.flag }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Code signing (optional — set these secrets to enable).
CSC_LINK: ${{ secrets.MACOS_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.MACOS_CSC_KEY_PASSWORD }}
# Notarization (optional — set these secrets to enable).
NOTARIZE: ${{ secrets.NOTARYTOOL_KEY != '' && '1' || '' }}
NOTARYTOOL_KEY: ${{ secrets.NOTARYTOOL_KEY }}
NOTARYTOOL_KEY_ID: ${{ secrets.NOTARYTOOL_KEY_ID }}
NOTARYTOOL_ISSUER: ${{ secrets.NOTARYTOOL_ISSUER }}

# Upload artifacts for manual dispatch builds (when not publishing to Releases).
- name: Upload build artifacts
if: steps.publish-mode.outputs.flag == 'never'
uses: actions/upload-artifact@v4
with:
name: electron-desktop-macos-${{ runner.arch }}
path: |
apps/electron-desktop/release/*.zip
apps/electron-desktop/release/*.dmg
apps/electron-desktop/release/*.blockmap
apps/electron-desktop/release/latest-mac.yml
if-no-files-found: error
retention-days: 14
12 changes: 10 additions & 2 deletions apps/electron-desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "atomicbot-desktop",
"private": true,
"version": "0.0.7",
"version": "0.0.8",
"description": "Atomic Bot makes things for you",
"type": "commonjs",
"main": "dist/main.js",
Expand Down Expand Up @@ -43,7 +43,8 @@
"dist:local": "CSC_IDENTITY_AUTO_DISCOVERY=false npm run dist -- --publish never",
"dist": "npm run build:all && electron-builder",
"dist:env": "npm run build:all && node --env-file=.env ./node_modules/electron-builder/out/cli/cli.js",
"dist:env:local": "CSC_IDENTITY_AUTO_DISCOVERY=false npm run dist:env -- --publish never"
"dist:env:local": "CSC_IDENTITY_AUTO_DISCOVERY=false npm run dist:env -- --publish never",
"release": "bash scripts/release.sh"
},
"devDependencies": {
"@reduxjs/toolkit": "^2.9.0",
Expand All @@ -64,6 +65,7 @@
"prettier": "^3.4.2"
},
"dependencies": {
"electron-updater": "^6.7.3",
"json5": "^2.2.3",
"react-hot-toast": "^2.6.0"
},
Expand Down Expand Up @@ -139,6 +141,12 @@
"to": "gog-credentials"
}
],
"publish": {
"provider": "github",
"owner": "AtomicBot-ai",
"repo": "atomicbot",
"releaseType": "draft"
},
"mac": {
"icon": "assets/icon.icns",
"category": "public.app-category.productivity",
Expand Down
30 changes: 30 additions & 0 deletions apps/electron-desktop/renderer/src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ type GhExecResult = {
resolvedPath: string | null;
};

type UpdateAvailablePayload = {
version: string;
releaseDate?: string;
};

type UpdateDownloadProgressPayload = {
percent: number;
bytesPerSecond: number;
transferred: number;
total: number;
};

type UpdateDownloadedPayload = {
version: string;
};

type UpdateErrorPayload = {
message: string;
};

declare global {
interface Window {
openclawDesktop?: {
Expand Down Expand Up @@ -70,6 +90,16 @@ declare global {
ghAuthStatus: () => Promise<GhExecResult>;
ghApiUser: () => Promise<GhExecResult>;
onGatewayState: (cb: (state: GatewayState) => void) => () => void;
// Auto-updater
checkForUpdate: () => Promise<void>;
downloadUpdate: () => Promise<void>;
installUpdate: () => Promise<void>;
onUpdateAvailable: (cb: (payload: UpdateAvailablePayload) => void) => () => void;
onUpdateDownloadProgress: (
cb: (payload: UpdateDownloadProgressPayload) => void
) => () => void;
onUpdateDownloaded: (cb: (payload: UpdateDownloadedPayload) => void) => () => void;
onUpdateError: (cb: (payload: UpdateErrorPayload) => void) => () => void;
};
}
}
2 changes: 2 additions & 0 deletions apps/electron-desktop/renderer/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Provider } from "react-redux";
import { HashRouter } from "react-router-dom";
import { App } from "./ui/App";
import { Toaster } from "./ui/Toaster";
import { UpdateBanner } from "./ui/UpdateBanner";
import { store } from "./store/store";
import "./ui/styles.css";
import "./ui/Sidebar.css";
Expand All @@ -18,6 +19,7 @@ ReactDOM.createRoot(document.getElementById("root")!).render(
<HashRouter>
<App />
<Toaster />
<UpdateBanner />
</HashRouter>
</Provider>
</React.StrictMode>
Expand Down
Loading
Loading