Skip to content
Draft
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
51 changes: 31 additions & 20 deletions .github/workflows/desktop-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,35 @@ name: Desktop release

# Builds the Edorax desktop app for Windows, macOS and Linux.
#
# Make a release: bump "version" in desktop/package.json, commit, then
# git tag desktop-v<version> && git push origin desktop-v<version>
# The tag must match the version in desktop/package.json.
# Pull requests build all three desktop targets without publishing a release.
# Merging desktop changes into main builds them again and publishes a pre-release.
# The release tag is created from the merged main commit using desktop/package.json.
#
# Or by hand: Actions tab -> "Desktop release" -> "Run workflow", then pick the branch.
# publish = false (default) build only; the installers are kept as workflow artifacts.
# publish = true also tag the commit as desktop-v<version in desktop/package.json>
# (or reuse that tag if it was pushed for this commit)
# and attach the installers to a GitHub pre-release.
# publish = true tag the selected commit and attach the installers to a pre-release.
#
# The app carries no labs. It downloads them from the server after sign-in, so this workflow needs no secrets.
# The installers are not code signed yet: Windows SmartScreen and macOS Gatekeeper will warn on first open.

on:
push:
tags: ["desktop-v*"]
pull_request:
paths:
- "desktop/**"
- "server/src/shared/**"
- ".github/workflows/desktop-release.yml"
workflow_dispatch:
inputs:
publish:
description: "Publish a GitHub pre-release (tag desktop-v<version>) after building"
type: boolean
default: false
push:
branches: [main]
paths:
- "desktop/**"
- "server/src/shared/**"
- ".github/workflows/desktop-release.yml"

permissions:
contents: write
Expand Down Expand Up @@ -73,24 +80,30 @@ jobs:
release:
name: Publish release
needs: make
if: inputs.publish || startsWith(github.ref, 'refs/tags/desktop-v')
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && inputs.publish)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Work out the tag from desktop/package.json
id: tag
run: |
version=$(node -p "require('./desktop/package.json').version")
tag="desktop-v${version}"
if [ "${GITHUB_REF_TYPE}" = "tag" ] && [ "${GITHUB_REF_NAME}" != "${tag}" ]; then
echo "::error::Pushed tag ${GITHUB_REF_NAME} does not match desktop/package.json (${tag}). Bump the version or fix the tag."
exit 1
fi
# A tag pushed by hand for this same commit is fine; a tag on another commit means the version was not bumped.
existing=$(git ls-remote --tags origin "refs/tags/${tag}^{}" "refs/tags/${tag}" | awk '{print $1}' | head -n1)
if [ -n "$existing" ] && [ "$existing" != "$GITHUB_SHA" ]; then
echo "::error::Tag ${tag} already exists on another commit. Bump the version in desktop/package.json first."
exit 1
# Reuse an existing version tag only when its commit is included in this release commit.
# Otherwise create the tag at the merged main commit.
if git show-ref --tags --verify --quiet "refs/tags/${tag}"; then
tagged_commit=$(git rev-list -n1 "${tag}")
if ! git merge-base --is-ancestor "${tagged_commit}" "${GITHUB_SHA}"; then
echo "::error::Tag ${tag} points to a commit outside this release history. Bump the version in desktop/package.json first."
exit 1
fi
else
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag "${tag}" "${GITHUB_SHA}"
git push origin "${tag}"
fi
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
Expand All @@ -110,8 +123,6 @@ jobs:
fail_on_unmatched_files: true
files: |
dist/**/*.exe
dist/**/*.nupkg
dist/**/RELEASES
dist/**/*.zip
dist/**/*.deb
dist/**/*.rpm
4 changes: 4 additions & 0 deletions desktop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ npm --prefix desktop start

Remote backends must use HTTPS. The API must implement `GET /api/v1/catalog`, returning the existing Buildment success envelope. The app imports only shared API types from `server/`; it does not bundle backend runtime code. Run install/build commands from this repository checkout.

On Windows, `pnpm --dir desktop make` builds an assisted NSIS setup wizard. It lets the learner
choose the install folder and whether to add Start menu and desktop shortcuts. The final page
includes a checkbox to launch Edorax after installation.

Sign-in opens the default browser (Chrome if configured as default). The web app defaults to `http://localhost:3000`; configure `BUILDMENT_WEB_URL` alongside `BUILDMENT_API_URL` for other deployments. Deploy the included web connection page and backend desktop authorization/exchange endpoints together. A short-lived, single-use code with proof verification returns through a loopback callback. Session tokens remain in Electron main-process memory, and closing the app requires signing in again. No database migration is required.

Course requests run in Electron's main process over a narrowly scoped preload bridge. Renderer Node integration is disabled. There are no credentials, fixture courses, or secrets in the application. Cover images use remote HTTPS URLs or local HTTP URLs; missing images show a decorative placeholder.
Expand Down
17 changes: 14 additions & 3 deletions desktop/forge.config.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { preparePty } from './scripts/prepare-pty.mjs';
import { stageIde } from './scripts/stage-ide.mjs';
import type { ForgeConfig } from '@electron-forge/shared-types';
import { MakerSquirrel } from '@electron-forge/maker-squirrel';
import { MakerNsis } from 'electron-forge-maker-nsis';
import { MakerZIP } from '@electron-forge/maker-zip';
import { MakerDeb } from '@electron-forge/maker-deb';
import { MakerRpm } from '@electron-forge/maker-rpm';
Expand Down Expand Up @@ -30,7 +30,7 @@ const config: ForgeConfig = {
!file.startsWith('/node_modules/node-addon-api'),
name: 'Edorax',
executableName: 'Edorax',
icon: './assets/edorax',
icon: './assets/edorax.ico',
extraResource: [
'./assets/edorax.png',
'./assets/edorax-dock.png',
Expand All @@ -43,7 +43,18 @@ const config: ForgeConfig = {
// Remove this line (back to rebuildConfig: {}) once the Build Tools are detected.
rebuildConfig: { onlyModules: [] },
makers: [
new MakerSquirrel({}),
new MakerNsis({
oneClick: false,
perMachine: false,
allowToChangeInstallationDirectory: true,
shortcutName: 'Edorax',
createStartMenuShortcut: false,
createDesktopShortcut: false,
runAfterFinish: true,
installerIcon: './assets/edorax.ico',
uninstallerIcon: './assets/edorax.ico',
include: './packaging/nsis-shortcut-options.nsh',
}),
// Zip for every system.
new MakerZIP({}, ['darwin', 'win32', 'linux']),
// Debian and Ubuntu: `sudo apt install ./edorax_<version>_amd64.deb`. The package sets up the
Expand Down
14 changes: 9 additions & 5 deletions desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
{
"name": "desktop",
"productName": "Edorax",
"version": "0.1.2",
"version": "0.1.3",
"private": true,
"description": "Edorax desktop learning workspace",
"keywords": [],
"license": "MIT",
"author": {
"name": "ASIF RAZA",
"name": "Edorax",
"email": "asifr.official9@gmail.com"
},
"main": ".vite/build/main.cjs",
"build": {
"appId": "com.edorax.desktop",
"win": {
"icon": "assets/edorax.ico"
}
},
"scripts": {
"prestart": "node scripts/ensure-ide.mjs",
"start": "electron-forge start",
Expand All @@ -34,20 +40,19 @@
"@electron-forge/cli": "^8.0.1",
"@electron-forge/maker-deb": "^8.0.1",
"@electron-forge/maker-rpm": "^8.0.1",
"@electron-forge/maker-squirrel": "^8.0.1",
"@electron-forge/maker-zip": "^8.0.1",
"@electron-forge/plugin-fuses": "^8.0.1",
"@electron-forge/plugin-vite": "^8.0.1",
"@electron/fuses": "^2.1.3",
"@playwright/test": "^1.64.1",
"@tailwindcss/vite": "^4.3.3",
"@types/dockerode": "^4.0.2",
"@types/electron-squirrel-startup": "^1.0.2",
"@types/js-yaml": "^4.0.9",
"@types/node": "^26.6.5",
"@types/react": "^19.3.0",
"@types/react-dom": "^19.3.0",
"electron": "^45.0.0",
"electron-forge-maker-nsis": "^26.18.0",
"oxfmt": "^0.74.0",
"oxlint": "^1.89.0",
"tailwindcss": "^4.3.3",
Expand All @@ -63,7 +68,6 @@
"@xterm/addon-fit": "^0.11.0",
"@xterm/xterm": "^6.0.0",
"dockerode": "^5.0.1",
"electron-squirrel-startup": "^1.0.1",
"js-yaml": "^5.5.0",
"lucide-react": "^1.61.0",
"monaco-editor": "^0.57.0",
Expand Down
59 changes: 59 additions & 0 deletions desktop/packaging/nsis-shortcut-options.nsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
!include "nsDialogs.nsh"
!include "LogicLib.nsh"

!ifndef BUILD_UNINSTALLER
Var shortcutOptionsDialog
Var desktopShortcutCheckbox
Var startMenuShortcutCheckbox
Var createDesktopShortcut
Var createStartMenuShortcut

!ifmacrodef customPageAfterChangeDir
!undef customPageAfterChangeDir
!endif
!macro customPageAfterChangeDir
Page custom ShortcutOptionsPage ShortcutOptionsLeave
!macroend

Function ShortcutOptionsPage
nsDialogs::Create 1018
Pop $shortcutOptionsDialog
${If} $shortcutOptionsDialog == error
Abort
${EndIf}

${NSD_CreateLabel} 0 0 100% 20u "Choose where to add Edorax shortcuts."
Pop $0

${NSD_CreateCheckbox} 0 32u 100% 16u "Add Edorax to the Start menu"
Pop $startMenuShortcutCheckbox
${NSD_Check} $startMenuShortcutCheckbox

${NSD_CreateCheckbox} 0 58u 100% 16u "Create a desktop shortcut"
Pop $desktopShortcutCheckbox
${NSD_Check} $desktopShortcutCheckbox

nsDialogs::Show
FunctionEnd

Function ShortcutOptionsLeave
${NSD_GetState} $startMenuShortcutCheckbox $createStartMenuShortcut
${NSD_GetState} $desktopShortcutCheckbox $createDesktopShortcut
FunctionEnd
!endif

!macro customInstall
${If} $createStartMenuShortcut == ${BST_CHECKED}
CreateDirectory "$SMPROGRAMS\Edorax"
CreateShortCut "$SMPROGRAMS\Edorax\Edorax.lnk" "$INSTDIR\Edorax.exe"
${EndIf}
${If} $createDesktopShortcut == ${BST_CHECKED}
CreateShortCut "$DESKTOP\Edorax.lnk" "$INSTDIR\Edorax.exe"
${EndIf}
!macroend

!macro customUnInstall
Delete "$SMPROGRAMS\Edorax\Edorax.lnk"
RMDir "$SMPROGRAMS\Edorax"
Delete "$DESKTOP\Edorax.lnk"
!macroend
Loading
Loading