Skip to content

Commit 26121be

Browse files
committed
ci: add Inno Setup installer and auto-update support
1 parent a08bd4e commit 26121be

File tree

5 files changed

+123
-11
lines changed

5 files changed

+123
-11
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,51 @@ jobs:
2323
node-version: 20
2424
cache: npm
2525

26-
- name: Set version from tag
27-
run: npm version ${{ github.ref_name }} --no-git-tag-version
28-
2926
- name: Install dependencies
3027
run: npm ci
3128

32-
- name: Build Electron app (Windows)
33-
run: npm run build
29+
- name: Build Electron app (unpacked)
30+
run: npx electron-builder --win dir
3431
env:
3532
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3633

34+
- name: Create placeholder icon if missing
35+
shell: powershell
36+
run: |
37+
if (!(Test-Path "build\icon.ico")) {
38+
New-Item -ItemType Directory -Force -Path build | Out-Null
39+
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/electron/electron/main/shell/browser/resources/win/electron.ico" -OutFile "build\icon.ico"
40+
}
41+
42+
- name: Create placeholder sidebar image if missing
43+
shell: powershell
44+
run: |
45+
if (!(Test-Path "build\installer-sidebar.bmp")) {
46+
New-Item -ItemType Directory -Force -Path build | Out-Null
47+
Add-Type -AssemblyName System.Drawing
48+
$bmp = [System.Drawing.Bitmap]::new(164, 314)
49+
$g = [System.Drawing.Graphics]::FromImage($bmp)
50+
$g.Clear([System.Drawing.Color]::FromArgb(30, 30, 30))
51+
$g.Dispose()
52+
$bmp.Save("build\installer-sidebar.bmp")
53+
$bmp.Dispose()
54+
}
55+
continue-on-error: true
56+
57+
- name: Compile Inno Setup installer
58+
shell: powershell
59+
run: |
60+
$version = "${{ github.ref_name }}".TrimStart("v")
61+
$iss = Get-Content installer.iss -Raw
62+
$iss = $iss -replace '#define MyAppVersion ".*"', "#define MyAppVersion `"$version`""
63+
$iss | Set-Content installer.iss
64+
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer.iss
65+
3766
- name: Upload Windows artifact
3867
uses: actions/upload-artifact@v4
3968
with:
4069
name: windows-build
41-
path: release/**/*-Setup.exe
70+
path: release/inno/*-Setup.exe
4271
if-no-files-found: error
4372

4473
build-linux:
@@ -67,9 +96,6 @@ jobs:
6796
fuse \
6897
libfuse2
6998
70-
- name: Set version from tag
71-
run: npm version ${{ github.ref_name }} --no-git-tag-version
72-
7399
- name: Install dependencies
74100
run: npm ci
75101

electron-builder.json5

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
appId: "Meridia",
55
asar: true,
66
productName: "Meridia",
7+
publish: {
8+
provider: "github",
9+
owner: "ridit-jangra",
10+
repo: "Meridia",
11+
},
712
directories: {
813
output: "release/${version}",
914
},

electron/main.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { app, BrowserWindow, ipcMain } from "electron";
2+
import { autoUpdater } from "electron-updater";
23
import { fileURLToPath } from "node:url";
34
import path from "node:path";
45
import { server } from "./server/lsp.server";
@@ -37,6 +38,34 @@ lsp_server.start();
3738

3839
let win: BrowserWindow | null = null;
3940

41+
// ─── Auto Updater ────────────────────────────────────────────────────────────
42+
function setup_auto_updater() {
43+
// Don't check for updates in dev mode
44+
if (VITE_DEV_SERVER_URL) return;
45+
46+
autoUpdater.autoDownload = true;
47+
autoUpdater.autoInstallOnAppQuit = true;
48+
49+
autoUpdater.on("update-available", (info) => {
50+
win?.webContents.send("updater:update-available", info.version);
51+
});
52+
53+
autoUpdater.on("update-downloaded", () => {
54+
win?.webContents.send("updater:update-downloaded");
55+
});
56+
57+
autoUpdater.on("error", (err) => {
58+
console.error("Auto updater error:", err);
59+
});
60+
61+
setTimeout(() => autoUpdater.checkForUpdates(), 3000);
62+
setInterval(() => autoUpdater.checkForUpdates(), 2 * 60 * 60 * 1000);
63+
}
64+
65+
ipcMain.on("updater:install-now", () => {
66+
autoUpdater.quitAndInstall();
67+
});
68+
4069
function createWindow() {
4170
const is_win = process.platform === "win32";
4271

@@ -115,4 +144,7 @@ app.on("activate", () => {
115144
if (BrowserWindow.getAllWindows().length === 0) createWindow();
116145
});
117146

118-
app.whenReady().then(createWindow);
147+
app.whenReady().then(() => {
148+
createWindow();
149+
setup_auto_updater();
150+
});

installer.iss

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#define MyAppName "Meridia"
2+
#define MyAppVersion "2.0.0-alpha.3"
3+
#define MyAppPublisher "Ridit Jangra"
4+
#define MyAppURL "https://github.com/ridit-jangra/Meridia"
5+
#define MyAppExeName "Meridia.exe"
6+
7+
[Setup]
8+
AppId=A1B2C3D4-E5F6-7890-ABCD-EF1234567890
9+
AppName={#MyAppName}
10+
AppVersion={#MyAppVersion}
11+
AppPublisher={#MyAppPublisher}
12+
AppPublisherURL={#MyAppURL}
13+
AppSupportURL={#MyAppURL}
14+
AppUpdatesURL={#MyAppURL}
15+
DefaultDirName={autopf}\{#MyAppName}
16+
DefaultGroupName={#MyAppName}
17+
DisableProgramGroupPage=yes
18+
LicenseFile=LICENSE.txt
19+
OutputDir=release\inno
20+
OutputBaseFilename=Meridia-Windows-{#MyAppVersion}-Setup
21+
SetupIconFile=build\icon.ico
22+
Compression=lzma2/ultra64
23+
SolidCompression=yes
24+
WizardStyle=modern
25+
WizardSmallImageFile=build\installer-sidebar.bmp
26+
PrivilegesRequired=lowest
27+
PrivilegesRequiredOverridesAllowed=dialog
28+
ArchitecturesAllowed=x64
29+
ArchitecturesInstallIn64BitMode=x64
30+
31+
[Languages]
32+
Name: "english"; MessagesFile: "compiler:Default.isl"
33+
34+
[Tasks]
35+
Name: "desktopicon"; Description: "Create a &desktop shortcut"; GroupDescription: "Additional shortcuts:"; Flags: checked
36+
Name: "startmenuicon"; Description: "Create a &Start Menu shortcut"; GroupDescription: "Additional shortcuts:"; Flags: checked
37+
38+
[Files]
39+
Source: "release\win-unpacked\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
40+
41+
[Icons]
42+
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: startmenuicon
43+
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
44+
45+
[Run]
46+
Filename: "{app}\{#MyAppExeName}"; Description: "Launch {#MyAppName}"; Flags: nowait postinstall skipifsilent
47+
48+
[UninstallDelete]
49+
Type: filesandordirs; Name: "{app}"

src/code/workbench/contrib/theme/theme.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const inject_css = (style_el: HTMLStyleElement, css: string) => {
1313

1414
export class theme_service {
1515
private themes: Record<theme_id, ITheme> = {};
16-
private active_id: theme_id = "light";
16+
private active_id: theme_id = "dark";
1717
private style_el: HTMLStyleElement;
1818

1919
constructor() {

0 commit comments

Comments
 (0)