Skip to main content
Self-update lets your launcher update itself. You deploy the launcher as its own repository, and the launcher checks it for updates before anything else.

How self-update works

  1. The launcher skin’s self-update component runs the state task in selfupdate.yaml to check whether an update is needed.
  2. If one is, the launcher shows an update button. Asking first tells the player that the update might need elevation, depending on the install folder. Set autoSelfUpdate: true in app.yaml to skip the button.
  3. When the player updates, the launcher downloads the new files, copies itself to a temporary folder and restarts from there.
  4. The restarted copy runs the apply task, which copies the new files into the install folder and restarts the launcher again.

Requirements

Configure selfupdate.yaml

app.yaml points to the self-update workflow with selfUpdateWorkflow:
app.yaml
In the load task of public/selfupdate.yaml, set the launcher repository’s location:
selfupdate.yaml
  • aliasUrl: the folder you deploy the launcher repository to.
  • repository: the launcher repository name. {moduleDistribution} adds the platform, such as win64, mac64 or macarm64, so each platform has its own repository.
  • buildEnv (in app.yaml): the environment to sync, such as qa or production.
Don’t change the other macros or tasks unless you’re sure of what you’re doing.
To turn off self-update while you develop, run the launcher with --disable-selfupdate, or set allowSelfUpdate: false in app.yaml.

Build the launcher

Build and sign the launcher with builder.py. Keep these the same in every release:
  • On Windows, the launcher’s file name. Renaming the executable breaks self-update.
  • On macOS, launcher_product_name. Changing it puts a second launcher next to the old one instead of updating it.
If you sign the macOS app yourself instead of with builder.py, use the same signing options every time, especially the designated requirement. Different values between versions can cause extra prompts if your launcher signs players in or saves to the keychain. See Sign a macOS launcher with codesign.

Deploy the launcher

Deploy each platform’s launcher with release_deploy.py to the repository name selfupdate.yaml expects, for example launcher-win64.
  • Windows: set source to the folder with the compiled launcher and its libraries.
  • macOS: set source to the .app folder itself, not its parent, for example --source="/Users/<you>/builds/1.0.0/My Launcher.app/".
Never run update_path.py for the launcher repository. Deltas are applied to files in place, but a self-update replaces files that are in use during a restart, so the two don’t work together.

Keep execute permissions on macOS

A macOS launcher must keep its execute permissions, or it overwrites itself with files that can’t run. If you compiled on a Mac, the files already have execute permission. Turn on sync_attributes to keep it:
If you compiled on Windows, list the files that need execute permission with executable_files, relative to source. Replace ProductName with your product name:

Avoid elevation on macOS

Don’t run the launcher with elevated privileges on macOS. Files created or changed by the root user can cause permission errors. Launchers in the Applications folder can update themselves as the current user.

Promote the launcher

Promote the release to the environment in buildEnv:

Test the self-update

From scratch

  1. Copy the launcher to a new folder.
  2. Run it from the command line with --debug --append.
With no local metafile, the launcher updates itself to the release you promoted, restarts, then processes your game repositories.

From one release to the next

  1. Build a changed launcher. An easy change to spot is the window title: set Host in public/locale/en.json, for example "Host": "Self-Update Test 2". You can also change file properties such as the version.
  2. Deploy it and promote the latest release.
  3. Run the existing launcher.
The launcher offers the update, downloads and applies it, restarts, and shows the new window title. When testing passes, set buildEnv for your next environment (for example stage), then build, deploy, promote and test there. You can automate all of these steps.