MelonInstaller

MelonInstaller installs Melon, updates it, and builds new releases. It speaks English and Spanish; pick one with:

MelonInstaller -lang ES

Versions

Every release belongs to a branch and has a four part version number. Each branch counts its own builds, adding one to the last number every build:

Beta 0.9.0.0  →  Beta 0.9.0.1  →  …  →  Beta 0.9.0.6
                                          ↓ promoted
                                     Stable 0.9.0.1

On GitHub, releases are tagged as the branch, a dash, then the version, and titled with a space:

TagTitle
Beta-0.9.0.0Beta 0.9.0.0
Stable-0.9.0.1Stable 0.9.0.1

Version numbers only mean something within a branch: Stable 0.9.0.1 can be newer than Beta 0.9.0.6. MelonGUI, MelonCLI, and check-for-updates show the running version.

Branches

There's no fixed list of branches. The installer looks at every release tag on GitHub and offers each branch that has at least one release. Today that's just Beta. Once a Stable release exists it becomes the default for new installs.

MelonInstaller -branch Beta                     # latest Beta
MelonInstaller -branch Beta -version 0.9.0.3    # a specific Beta
MelonInstaller -version Stable-0.9.0.1          # a full tag picks the branch too

The installed branch and version are kept in melon-release.json in the install folder.

Switching Branches

You can move to another branch at any time. If the target has a lower version number than what's installed, the installer warns you first and asks to continue:

[!] Switching from Beta 0.9.0.6 to Stable 0.9.0.1 installs an older version number. ...
Continue? (y/N)

When there's no one to ask (the -update flow, or input is redirected), add -force to switch anyway. Server updates only switch branches when you pick another branch in a controller (or pass branch to update-melon).

Installing

Run MelonInstaller with no arguments. It asks for a branch and an install path, then installs the latest release on that branch. When it finishes it opens MelonGUI, or MelonCLI in the same terminal if you ran it from one.

ArgumentDoes
-installPath <path>Install here without asking.
-branch <name>Install from this branch.
-version <version or tag>Install this release instead of the latest.
-localPath <zip>Install from a downloaded release zip.
-forceSwitch to a lower version on another branch without asking.
-noLaunchDon't open MelonGUI or MelonCLI afterwards.

Each release has one zip per platform:

AssetContains
Melon-win-x64.zipServer, Controller (MelonGUI), CLI, Installer
Melon-linux-x64.zipServer, CLI, Installer
Melon-osx-arm64.zipServer, CLI, Installer
MelonInstaller-<platform>The installer on its own

Updates

When you update from MelonGUI, MelonCLI or the update-melon endpoint, the server does it itself:

  1. It finds the newest release on its branch (or the branch you picked), downloads that platform's bundle, and checks its SHA-256 checksum.
  2. It unpacks the bundle into a .melon-update-* folder next to the install and checks every installed part is there.
  3. It stops a running library scan (what was read is saved) and the artwork fetch, then stops.
  4. The files are swapped by renaming: each old file moves into the stage's previous folder and the new one takes its place. If anything fails, every file goes back. On Windows a script does this once the server has exited; on Linux and macOS the server does it before it exits, since files can be replaced under a running process.
  5. The new version starts: the Windows service or the script on Windows, systemctl restart under systemd, launchctl kickstart under launchd, or a detached relaunch otherwise.

Each step is written to update-status.json in Melon's data folder. Controllers read it while the server is down, and the new server marks the update done (or failed, if the old version came back) when it starts. Open controllers don't need to close: a running exe can be renamed, so they keep running the old code through the swap, then start the new exe and close once the new server answers.

You can call for an update yourself with:

MelonInstaller -update -installPath <installationDir>

Add -restart to start the server again afterwards:

MelonInstaller -update -restart -installPath <installationDir>

Building

MelonInstaller builds a release bundle with -build. Point it at the Code folder:

MelonInstaller -build -buildPath ./Code -branch Beta -outputPath ./Build
[+] Building Beta 0.9.0.3 (win-x64)

[1/5] Server         45s
[2/5] CLI            20s
[3/5] Installer      15s
[4/5] Controller     40s
[5/5] Zip            10s

[+] Build Package created at ./Build/Melon-Beta-0.9.0.3-win-x64.zip (231 MB, 2m 10s)
[+] Publish it as GitHub release tag Beta-0.9.0.3 (Beta 0.9.0.3)

The Controller step only happens on Windows. The output from dotnet publish goes to a .log file next to the zip instead of the screen. If a step fails, the installer prints the error lines and where the log is. If the build works, the log gets deleted.

Every app is built with its own copy of .NET, so people don't need .NET installed to run Melon. Each app is also bundled into a single exe. A few files have to stay next to the exe:

There are no .pdb debug files in a release.

The build count lives in Code/MelonInstaller/BuildVersions.json, so commit it after a build:

{
  "base": "0.9.0",
  "branches": { "Beta": "0.9.0.3" }
}
ArgumentDoes
-branch <name>The branch to number against. Defaults to Beta.
-baseVersion 0.10.0Start a new line at 0.10.0.0. A four part version is used as is.
-outputPath <dir>Where the zip goes. Defaults to Build.
-versionFile <file>Use another build count file.

Publishing a GitHub release with a Branch-Version tag runs the Release bundles workflow, which stamps the version, builds all three platforms, and attaches the zips and installers.