RuneStone 1.0.0

This commit is contained in:
Knotty Wyvern
2026-11-16 04:21:21 -07:00
commit b52eeb14a1
827 changed files with 241421 additions and 0 deletions
+273
View File
@@ -0,0 +1,273 @@
# Build RuneStone
[Development](development.md) · [Releases](releases.md) · [Installation](installation.md)
This guide tells maintainers how to build RuneStone installers and packages. Users install a supplied file with the [installation guide](installation.md).
Use the [release policy](releases.md) to select the version, store the files, and publish them.
## Build the Windows installer
`pnpm build:installer` builds an NSIS setup file for 64-bit Windows (x64). The script stops on other operating systems.
Prerequisites:
- The source setup in [Run from source](development.md#run-from-source).
- The pin of the browser engine in `src-tauri/browser-engine.json`. To build a new engine first, see [Build the browser engine](#build-the-browser-engine). The installer does not include the engine.
- Internet access for the first build. Tauri downloads NSIS and the WebView2 bootstrapper.
Procedure, in the RuneStone repository root:
1. Run `pnpm install --frozen-lockfile`.
2. Run `pnpm check`.
3. Run `pnpm test`.
4. Select the version with the [version policy](releases.md#versions).
5. Run `pnpm build:installer --version <version> --dry-run`. Make sure that the plan shows the correct versions. A dry run changes no file.
6. Run `pnpm build:installer --version <version>`.
Without `--version`, the script uses the version in `package.json`.
Output:
| File | Contents |
| --- | --- |
| `releases/<version>/RuneStone_<version>_x64-setup.exe` | The setup file to distribute |
| `releases/<version>/host.json` | The release version, the encoded toolchain and Windows versions, the file name, the size in bytes, and the SHA-256 hash |
The script prints `Installer available: <path>` when it completes.
After a successful build, the version fields keep the new version.
Example, from the 1.0.0 download link in the README: version `1.0.0` gives `releases/1.0.0/RuneStone_1.0.0_x64-setup.exe`.
### What the script does
Source: `scripts/buildInstaller.mjs`.
1. Reads the version and makes sure that all version fields match the current version.
2. Makes sure that downgrade protection stays on in `tauri.conf.json` and `tauri.windows.conf.json`.
Makes sure that `tauri.windows.conf.json` names the installer hooks and that `tauri.conf.json` does not bundle the browser engine.
3. Stops if the setup file or `host.json` exists in the bundle folder or in `releases/<version>/`.
A dry run prints the plan and stops here.
4. Saves copies of the four version files as `*.before` in `output/installer-build/<version>/<time>/`, a new folder for each attempt.
It also writes the configuration override `tauri.version.json` to that folder. The override sets the toolchain version, for example `{"version": "0.1.23+1"}`.
5. Runs `tauri build --no-bundle --config <override> -- --locked` with `RUNESTONE_VERSION` set to the release version. This runs `pnpm build` and compiles the release app.
`vite.config.js` gives `RUNESTONE_VERSION` to the front end for the Settings dialog. Without it, the front end uses the version in `package.json`.
Tauri gives the override to the Rust build script and to the app. Cargo keeps the previous package version, so the app must not use `CARGO_PKG_VERSION`.
6. Runs `scripts/setWindowsVersion.ps1`. It writes the release version to the `FileVersion` and `ProductVersion` strings of `runestone.exe`. Tauri can write only a SemVer version to these strings.
7. Runs `tauri bundle --bundles nsis --config <override>`. Tauri uses its stock NSIS template with the [installer hooks](#installer-hooks).
8. Stops if the setup file is larger than 30 MB. The core installer is about 10 MB.
Moves the setup file into `releases/<version>/`, writes `host.json`, and removes the bundle-folder copy.
9. Writes the new version to `package.json`, `tauri.conf.json`, `Cargo.toml`, and `Cargo.lock`.
### Failure and rollback
The version files change only in step 9. If a step fails, or you press Ctrl+C, the version files keep the previous version. If step 9 fails, the script restores them.
It moves partial setup files and `host.json` into the folder of that attempt with a `.failed-<timestamp>` suffix.
If the process is killed before this cleanup, copy the `*.before` files of the attempt back to their original names.
## Installer requirements
Keep these properties when you change the installer configuration or hooks:
| Requirement | Implementation |
| --- | --- |
| Reinstall is the default when RuneStone is installed, also for the same version. | The hooks make the stock maintenance page skip itself. Setup replaces the app in place. |
| Users do not uninstall RuneStone before an update or a reinstall. | Setup does not start the uninstaller of the installed version. |
| Updates and reinstalls keep workspace files and user settings. | Workspaces stay outside the installation folder. Settings stay in application data. |
| Older versions cannot replace a newer installation. | The hooks stop setup with exit code 2 in all modes: interactive, passive (`/P`), silent (`/S`), and update (`/UPDATE`). An installed version with an unknown format also stops setup. `allowDowngrades` stays `false`. `pnpm build:installer` stops if this setting changes. |
| Windows shows the release version in installed apps. | The hooks write the release version, such as `0.1.23a`, to `DisplayVersion`. |
| The app identity stays the same across upgrades. | The identifier stays `com.runestone.app`. |
| WebView2 is available. | The installer embeds the WebView2 bootstrapper. If the runtime is missing, setup downloads it. |
| An update removes the engine folder of releases up to 0.1.48. | `NSIS_HOOK_POSTINSTALL` removes `$INSTDIR\browser-engine`. The uninstaller of the old version does not run, so nothing else removes it. |
| Uninstall removes the downloaded browser engine. The browser profiles stay unless the user deletes the app data. | `NSIS_HOOK_POSTUNINSTALL` removes `browser-engine` in the local app data folder, except during an update. |
The installer uses the RuneStone icon, installs for the current Windows account, and adds a Start menu shortcut and an uninstaller.
It does not register document types or start RuneStone when Windows starts.
Local installers are unsigned. Configure Windows code signing with [Tauri's signing guide](https://v2.tauri.app/distribute/sign/windows/) before public distribution.
See [Tauri's Windows installer documentation](https://v2.tauri.app/distribute/windows-installer/) for packaging options.
### Installer hooks
RuneStone uses the stock NSIS template of the Tauri CLI.
`src-tauri/windows/hooks.nsh` adds the RuneStone behavior. `tauri.windows.conf.json` names this file in `bundle.windows.nsis.installerHooks`.
| Hook | When it runs | What it does |
| --- | --- | --- |
| `RuneStoneGuiInit`, set as `MUI_CUSTOMFUNCTION_GUIINIT` | Interactive and passive (`/P`) setup, before the first page | Stops a downgrade. Makes the maintenance page skip itself. |
| Section `-RuneStoneVersionCheck` | All modes, before the Tauri sections | Restores the current-user context. Stops a downgrade. Silent setup shows no pages, so it needs this check. |
| `NSIS_HOOK_POSTINSTALL` | At the end of the Tauri `Install` section | Writes `DisplayVersion`, `RuneStoneReleaseVersion`, and `RuneStoneWindowsVersion`. Removes `$INSTDIR\browser-engine`. |
| `NSIS_HOOK_POSTUNINSTALL` | At the end of the Tauri `Uninstall` section | Removes `$LOCALAPPDATA\com.runestone.app\browser-engine`, except in update mode. |
Tauri includes the hooks file before the template variables, pages, and sections.
Thus only the `NSIS_HOOK_*` macros can use template symbols such as `${VERSION}`.
The other hook code reads the version of the setup file from its version resource.
The stock maintenance page preselects "Uninstall before installing" for an upgrade.
In passive mode, it also starts the uninstaller for a same-version reinstall. A hook cannot change this page.
Thus `RuneStoneGuiInit` sets the shell context to all users. The page then looks in `HKLM`, does not find the current-user installation, and skips itself.
`tests/unit/release/installerVersion.spec.ts` reads the template from the installed Tauri CLI. It checks the template parts that the hooks use.
After a Tauri update, run `pnpm test`. If this check fails, adapt the hooks before you build an installer.
## Hotfix installer versions
Cargo and Tauri accept only SemVer versions. The Windows version resource accepts only four numbers.
`scripts/releaseVersion.mjs` encodes a hotfix version for those fields. The encoding does not create a separate build or change the release version.
The suffix index counts `a` = 1 through `z` = 26, then `aa` = 27. A regular version has index 0.
| Field | Value for `0.1.23a` |
| --- | --- |
| `package.json`, `[package.metadata.runestone]`, the setup file name, the version in Settings, and the executable `FileVersion` and `ProductVersion` strings | `0.1.23a` |
| Registry values `DisplayVersion`, which Windows shows in installed apps, and `RuneStoneReleaseVersion` | `0.1.23a` |
| `tauri.conf.json`, the Cargo package version, `Cargo.lock`, and the `FileVersion` and `ProductVersion` strings of the setup file | `0.1.23+1` |
| The numeric Windows version resources of the executable and the setup file, and the registry value `RuneStoneWindowsVersion` | `0.1.23.1` |
During the build, Tauri gets `0.1.23+1` from a configuration override. The script writes the table values to the files only after the installer is complete.
The NSIS template writes the version strings of the setup file. A hook cannot change them, so they keep the toolchain version.
Each numeric part and the suffix index must not exceed 65535. The last valid suffix is `crxo`.
The script rejects other versions before it changes a file.
Setup compares Windows versions with the NSIS function `${VersionCompare}`. Their order is the release order:
`0.1.23 < 0.1.23a < 0.1.23b < 0.1.23z < 0.1.23aa < 0.1.24`.
Setup reads the installed version from `RuneStoneWindowsVersion`.
If that value is missing, setup reads `DisplayVersion`. Earlier installers wrote the toolchain version there, such as `0.1.23+1`.
An installed version with an unknown format stops setup.
Installers from 0.1.23a to 0.1.44 read `RuneStoneReleaseVersion`, so they also detect a newer hotfix installation.
## Installer checks
Do these checks on a separate Windows test account or virtual machine. A successful build does not prove them.
The unit tests compile small NSIS programs with the hooks file. They do not run a real RuneStone setup file.
Do all checks in this table for the first installer that uses the stock template and the hooks file. Do not publish that installer before all checks pass.
| Check | Expected result |
| --- | --- |
| Install on an account without Node.js or Rust | Setup completes and RuneStone opens. |
| Install without WebView2, with internet access | Setup installs the runtime and RuneStone opens. |
| Open RuneStone from the Start menu | The app opens without a terminal or a development server. |
| Create a workspace outside the installation folder | Notes save and open again. |
| Install the new version over 0.1.44 | Setup shows no maintenance page and does not start the uninstaller. It updates the app and keeps workspace files and settings. |
| Install the new version over 0.1.48 | The `browser-engine` folder in the installation folder is gone. At the first browser start, the browser profiles move from `%APPDATA%` to `%LOCALAPPDATA%`. |
| Open a browser tab, then select **Download the engine** | The download shows its progress. Then the tab opens its page. |
| Open a browser tab without internet access | The tab shows the cause, **Retry**, and **Install from file…**. Web links in documents open in the system browser. |
| Install the same version again | Setup shows no maintenance page and does not start the uninstaller. It keeps workspace files and settings. |
| Install an older version, for example 0.1.44 | Setup blocks the downgrade. |
| Silent downgrade attempt | See the procedure below this table. Setup stops with exit code 2 and changes nothing. |
| Open **Settings → Apps → Installed apps** in Windows | The RuneStone entry shows the release version, such as `0.1.45` or `0.1.45a`. |
| Install a hotfix over its base version | Setup updates the app. |
| Remove RuneStone through Windows Settings | The app, the shortcuts, and the downloaded browser engine are removed. The separate workspace stays. |
Silent downgrade attempt, in PowerShell on the test account:
1. Install the new version.
2. Simulate a newer installation:
`Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\RuneStone' RuneStoneWindowsVersion '9.0.0.0'`
3. Run the setup file in silent mode and show its exit code:
`(Start-Process .\RuneStone_<version>_x64-setup.exe -ArgumentList '/S' -Wait -PassThru).ExitCode`
4. Make sure that the exit code is `2` and that installed apps show the same version as before.
5. Run the same command with `-ArgumentList '/P'`. Setup shows a message, then stops with exit code `2`.
6. Restore the registry value: set `RuneStoneWindowsVersion` to the `windowsVersion` value in `host.json`.
## Build the browser engine
`pnpm build:browser-engine` packages the browser engine for 64-bit Windows (x64) as a ZIP. Then it pins that ZIP in `src-tauri/browser-engine.json`. Each later host build downloads the pinned engine on first use.
Build and publish the engine before the installer that pins it. An installer needs a new engine only when the engine changes.
Prerequisites:
- Windows x64. The script stops on other systems, because no other platform has a published engine yet.
- `npm ci --prefix browser-runtime`, then `pnpm browser:check` and `pnpm browser:test`. See [Built-in browser runtime](development.md#built-in-browser-runtime).
- The public folder URL of the engine release. See [Publish a browser engine](releases.md#publish-a-browser-engine).
Procedure, in the RuneStone repository root:
1. Select the engine version with the [version policy](releases.md#versions). The engine version is in `browser-runtime/package.json`.
2. Run `pnpm build:browser-engine --release-url <folder URL> --version <version> --dry-run`. Make sure that the plan shows the correct version and URL. A dry run changes no file.
3. Run `pnpm build:browser-engine --release-url <folder URL> --version <version>`.
4. Publish the ZIP. See [Publish a browser engine](releases.md#publish-a-browser-engine).
Output:
| File | Contents |
| --- | --- |
| `releases/browser-engine/<version>/RuneStone-Browser_<version>_win32-x64.zip` | The engine files at the archive root, in name order, with a fixed time stamp |
| `releases/browser-engine/<version>/engine.json` | The version, the protocol, the platform key, the file name, the URL, the size in bytes, and the SHA-256 hash |
| `src-tauri/browser-engine.json` | The pin: the engine version, the protocol, and the URL, size, and SHA-256 for `windows-x86_64` |
The script prints `Engine available: <path>`, the size, the hash, and the upload URL when it completes.
The script writes the new version to `browser-runtime/package.json` and `package-lock.json` before it packages the engine, because the engine reports that version. If a step fails, the script restores these files and the pin. The backups are in `output/browser-engine-build/<version>/<time>/`.
The script reads `PROTOCOL` in `src-tauri/src/browser_engine.rs` and the protocol of the `ready` event in `browser-runtime/src/engine-main.mjs`. It stops if they differ.
Example, with Electron 44.5.1 from `browser-runtime/package.json`: the engine files are 377 MB, and the ZIP is about 160 MB.
## Build Linux packages
Prerequisites:
- The [Linux development prerequisites](linux.md) on the processor architecture of the package.
- The new version in all RuneStone version fields. No Linux script sets or restores them. See [Versions](releases.md#versions).
Procedure, in the RuneStone repository root. The commands use the Tauri CLI from `package.json` and the bundle settings in `src-tauri/tauri.linux.conf.json`.
1. Build the package format that you need:
```sh
# Debian package
pnpm tauri build --bundles deb -- --locked
# AppImage
pnpm tauri build --bundles appimage -- --locked
```
2. Find the package in `src-tauri/target/release/bundle/deb/` or `src-tauri/target/release/bundle/appimage/`.
3. Move the package into `releases/<version>/`. Do not leave a copy in the bundle folder.
4. Put the checksums, the source commit, the environment, the test results, and the untested cases in the same folder.
If the build fails, restore the previous version fields.
Example, from `productName` and `version` in `src-tauri/tauri.conf.json`: the x86_64 Debian build of version `1.0.0` is `RuneStone_1.0.0_amd64.deb`.
`pnpm build:installer` does not build Linux packages. It stops on operating systems other than Windows.
Linux packages do not include the browser engine, and no Linux engine is published yet. The browser tab says that no engine is available for the platform.
No Linux script encodes hotfix versions, and Tauri rejects a letter suffix in `tauri.conf.json`. Report this blocker before a Linux hotfix build.
The Debian package depends on `libc6 (>= 2.39)`, as set in `tauri.linux.conf.json`.
A package built on a newer system can need libraries that an older system does not have. An AppImage does not remove this limit.
For a shared package, build on the oldest distribution that you support and that supplies WebKitGTK 4.1.
See [Tauri's Debian guide](https://v2.tauri.app/distribute/debian/) and [Tauri's AppImage guide](https://v2.tauri.app/distribute/appimage/).
Test a Debian package with the [Linux installation procedure](installation.md#install-on-linux) on a separate test account:
| Check | Expected result |
| --- | --- |
| Launch without development tools | RuneStone opens. |
| Install the same version again | Settings and workspace files stay. |
| Install a newer version | Settings and workspace files stay. |
| Remove the package | Workspaces outside the installation folder stay. |
Call a distribution supported only after its native tests and package checks pass. Repeat the automated checks on a Linux runner before each Linux release.
For an example record, see the [Linux 0.1.44 validation](archive/linux-validation-0.1.44.md).
## macOS packages
macOS packages are experimental. RuneStone has no validated macOS release procedure.
Prerequisites: a Mac and the source setup.
In the RuneStone repository root, run:
```sh
pnpm tauri build --bundles app -- --locked
```
Tauri puts the application bundle in `src-tauri/target/release/bundle/macos/`. No script sets the version fields on macOS.
macOS packages do not include the browser engine, and no macOS engine is published yet.
The [macOS 0.1.44 record](archive/macos-validation-0.1.44.md) describes the ad hoc signatures and the DMG steps of that release.
Developer ID signing, notarization, Intel builds, and desktop acceptance tests are not done for macOS.
See [Tauri's macOS application bundle guide](https://v2.tauri.app/distribute/macos-application-bundle/).