Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/desktop-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Desktop checks
# server/src/shared/** code the desktop app imports from the server
# this workflow and the release workflow
# A change to only the server, the web app or the docs does not start this workflow.
# The release builds (Windows, macOS, Linux) are a separate workflow that runs on a tag or by hand.
# The release builds (Windows, macOS, Linux) are a separate workflow that runs only by hand.

on:
pull_request:
Expand Down
47 changes: 42 additions & 5 deletions .github/workflows/desktop-release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
name: Desktop release

# Builds the Edorax desktop app for Windows, macOS and Linux and attaches the installers to a GitHub release.
# Builds the Edorax desktop app for Windows, macOS and Linux.
#
# Make a release: git tag desktop-v0.1.0 && git push origin desktop-v0.1.0
# Try the builds: run this workflow by hand (Actions tab). The installers are kept as workflow artifacts.
# 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.
#
# 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.
#
# 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.
Expand All @@ -12,6 +19,11 @@ on:
push:
tags: ["desktop-v*"]
workflow_dispatch:
inputs:
publish:
description: "Publish a GitHub pre-release (tag desktop-v<version>) after building"
type: boolean
default: false

permissions:
contents: write
Expand Down Expand Up @@ -43,6 +55,10 @@ jobs:
node-version: 22
cache: pnpm
cache-dependency-path: desktop/pnpm-lock.yaml
# The .deb and .rpm makers need these tools on the Linux runner.
- if: runner.os == 'Linux'
run: sudo apt-get update -qq && sudo apt-get install -y -qq fakeroot rpm
working-directory: .
- run: pnpm install --frozen-lockfile
# The desktop build imports shared code from server/src/shared, which needs the server's packages.
- run: pnpm --dir ../server install --frozen-lockfile
Expand All @@ -57,9 +73,26 @@ jobs:
release:
name: Publish release
needs: make
if: startsWith(github.ref, 'refs/tags/desktop-v')
if: inputs.publish || startsWith(github.ref, 'refs/tags/desktop-v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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
fi
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
- uses: actions/download-artifact@v4
with:
path: dist
Expand All @@ -68,7 +101,9 @@ jobs:
run: find dist -type f | sort
- uses: softprops/action-gh-release@v2
with:
name: Edorax desktop ${{ github.ref_name }}
tag_name: ${{ steps.tag.outputs.tag }}
target_commitish: ${{ github.sha }}
name: Edorax desktop ${{ steps.tag.outputs.tag }}
# A first release stays a pre-release until it has been tried on all three systems.
prerelease: true
generate_release_notes: true
Expand All @@ -78,3 +113,5 @@ jobs:
dist/**/*.nupkg
dist/**/RELEASES
dist/**/*.zip
dist/**/*.deb
dist/**/*.rpm
3 changes: 3 additions & 0 deletions desktop/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,3 +149,6 @@ playwright-report/

# Shell labs are copied from Edorax Core by `pnpm sync:labs`; Core owns them.
/labs/

# Slim copy of the built IDE that Forge ships (scripts/stage-ide.mjs).
/.ide-bundle/
39 changes: 36 additions & 3 deletions desktop/forge.config.mts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
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 { MakerZIP } from '@electron-forge/maker-zip';
import { MakerDeb } from '@electron-forge/maker-deb';
import { MakerRpm } from '@electron-forge/maker-rpm';
import { VitePlugin } from '@electron-forge/plugin-vite';
import { FusesPlugin } from '@electron-forge/plugin-fuses';
import { FuseV1Options, FuseVersion } from '@electron/fuses';
Expand All @@ -11,6 +14,10 @@ const config: ForgeConfig = {
generateAssets: async () => {
await preparePty();
},
// Ship only the built IDE (lib, plugins, package.json), not ide/node_modules and its sources.
prePackage: async () => {
await stageIde();
},
},
packagerConfig: {
asar: { unpack: '**/node_modules/node-pty/**' },
Expand All @@ -22,11 +29,13 @@ const config: ForgeConfig = {
!file.startsWith('/node_modules/node-pty') &&
!file.startsWith('/node_modules/node-addon-api'),
name: 'Edorax',
executableName: 'Edorax',
icon: './assets/edorax',
extraResource: [
'./assets/edorax.png',
'./assets/edorax-dock.png',
'./ide',
// Staged by scripts/stage-ide.mjs; still lands at resources/ide.
'./.ide-bundle/ide',
],
},
// TEMPORARY: node-pty's Electron rebuild needs a working Visual Studio install, which this machine
Expand All @@ -35,9 +44,33 @@ const config: ForgeConfig = {
rebuildConfig: { onlyModules: [] },
makers: [
new MakerSquirrel({}),
// Zip for every system. Linux uses the zip for now: the .deb and .rpm makers crash in this
// dependency layout (an old glob picks up the wrong minimatch), so they are left out until that is fixed.
// Zip for every system.
new MakerZIP({}, ['darwin', 'win32', 'linux']),
// Debian and Ubuntu: `sudo apt install ./edorax_<version>_amd64.deb`. The package sets up the
// sandbox helper, the menu entry and the `edorax` command by itself. These makers take their
// settings directly (no `options` wrapper), and `electron-forge make --targets ...` ignores them.
new MakerDeb({
name: 'edorax',
productName: 'Edorax',
genericName: 'Learning app',
bin: 'Edorax',
maintainer: 'Edorax <support@edorax.com>',
homepage: 'https://www.edorax.com',
categories: ['Education', 'Development'],
icon: './assets/edorax.png',
}),
// Fedora and RHEL: `sudo dnf install ./edorax-<version>.x86_64.rpm`.
new MakerRpm({
name: 'edorax',
productName: 'Edorax',
genericName: 'Learning app',
bin: 'Edorax',
homepage: 'https://www.edorax.com',
categories: ['Education', 'Development'],
icon: './assets/edorax.png',
// rpm 4.20+ (current ubuntu-latest) breaks the stock template's relative `cp -r usr/*`.
specTemplate: './packaging/rpm.spec.ejs',
}),
],
plugins: [
new VitePlugin({
Expand Down
7 changes: 4 additions & 3 deletions desktop/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "desktop",
"productName": "Edorax",
"version": "0.1.0",
"version": "0.1.2",
"private": true,
"description": "Edorax desktop learning workspace",
"keywords": [],
Expand All @@ -21,7 +21,7 @@
"sync:labs": "node scripts/sync-labs.mjs",
"lint:fix": "oxlint --fix && oxfmt --write",
"typecheck": "tsc --noEmit",
"test": "tsx --test tests/api.test.ts tests/labs.test.ts tests/local-runtime.test.ts tests/ide.test.ts tests/shell-labs.test.ts tests/shell-labs-catalog.test.ts tests/guided-labs.test.ts tests/docker-setup.test.ts tests/app-version.test.ts tests/update-service.test.ts",
"test": "tsx --test tests/api.test.ts tests/labs.test.ts tests/local-runtime.test.ts tests/ide.test.ts tests/shell-labs.test.ts tests/shell-labs-catalog.test.ts tests/guided-labs.test.ts tests/docker-setup.test.ts tests/app-version.test.ts tests/update-service.test.ts tests/lab-progress.test.ts",
"test:ui": "playwright test",
"dev:ui": "vite --config vite.renderer.config.mts --host 127.0.0.1 --port 5179 --strictPort",
"test:labs": "tsx --test tests/labs.integration.test.ts tests/shell-labs.integration.test.ts",
Expand Down Expand Up @@ -78,6 +78,7 @@
},
"overrides": {
"dompurify": "3.4.17",
"minimatch": "^11.0.5"
"minimatch": "^11.0.5",
"glob@7>minimatch": "^3.1.2"
}
}
64 changes: 64 additions & 0 deletions desktop/packaging/rpm.spec.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<% /* Copy of electron-installer-redhat 4.0.0 resources/spec.ejs. Only change: %install copies from %{_topdir}/BUILD/usr
instead of a relative usr/, because rpm 4.20+ runs %install from BUILD/<name>-<version>-build. */ %>
%define _binary_payload w<%= compressionLevel %>.xzdio

%if "%{_host_cpu}" != "%{_target_cpu}"
%global __strip /bin/true
%endif

Name: <%= name %>
Version: <%= version %>
Release: <%= revision %>%{?dist}
<% if (description) { print(`Summary: ${description}\n`) }
%>
<% if (license) { print(`License: ${license}\n`) }
if (homepage) { print(`URL: ${homepage}\n`) }
if (license || homepage) { print('\n') }

%>Requires: <%= requires.join(', ') %>
AutoReqProv: no

<% if (productDescription) {
%>%description
<% print(productDescription)
print('\n\n\n') }


%>%install
mkdir -p %{buildroot}/usr/
cp <%= process.platform === 'darwin' ? '-R' : '-r' %> %{_topdir}/BUILD/usr/* %{buildroot}/usr/


%files
/usr/bin/<%= name %>
/usr/lib/<%= name %>/
/usr/share/applications/<%= name %>.desktop
/usr/share/doc/<%= name %>/
<% if (_.isObject(icon)) {
_.forEach(icon, function (path, resolution) {
%>/usr/share/icons/hicolor/<%= resolution %>/apps/<%= name %><%= resolution === 'symbolic' ? '-symbolic' : '' %>.<%= ['scalable', 'symbolic'].includes(resolution) ? 'svg' : 'png' %>
<% }) } else {
%>/usr/share/pixmaps/<%= name %>.png
<% } %>

<% if (pre) {
%>%pre
<% print(pre)
if (preun || post || postun) print('\n\n\n') }


%><% if (preun) {
%>%preun
<% print(preun)
if (post || postun) print('\n\n\n') }


%><% if (post) {
%>%post
<% print(post)
if (postun) print('\n\n\n') }


%><% if (postun) {
%>%postun
<% print(postun) } %>
32 changes: 31 additions & 1 deletion desktop/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions desktop/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ allowBuilds:
overrides:
dompurify: 3.4.17
minimatch: ^11.0.5
"glob@7>minimatch": ^3.1.2
Loading
Loading