Skip to content

Publishing and updates

Publish on GitHub and itch.io, and let apps update themselves through release channels and phased rollouts.

When the build has a macOS, Windows or Linux target, dist/releases also holds install.sh and install.ps1, which install the app from the releases of the GitHub repository release.github names, else the one the app’s Git remote origin is on; without either build writes none and says so. Upload its files, the top level without miniprogram/ and minigame/, to the release tagged v<version> (release.tag_prefix replaces v; the scripts encode reserved URL characters in that prefix):

gh release create v1.2.0 dist/releases/*.*

Users then install or update the app with one line, which the build prints:

curl -fsSL https://github.com/me/hello/releases/latest/download/install.sh | sh # macOS and Linux
irm https://github.com/me/hello/releases/latest/download/install.ps1 | iex # Windows

On macOS the script copies the app from the disk image into /Applications, or ~/Applications when it cannot write there; on Linux it installs the Arch package with pacman, else the Debian one with apt-get or dpkg, through sudo; on Windows it runs the installer silently, which installs where the app already is. Each checks the file against its checksum first. <NAME>_VERSION, the app’s name in capitals, such as HELLO_VERSION=1.1.0, installs another release, and <NAME>_DOWNLOAD_URL downloads from a mirror.

Set itch.project to your itch.io game’s owner/game slug in nsgo.yaml. To override channel names, set itch.channels by build target. The defaults are html5 for web, osx-<arch> for macOS, windows-<arch> for Windows and linux-<arch> for Linux.

itch:
project: example/my-game
channels:
macos_arm64: osx-arm64-beta

With BUTLER_API_KEY set as a secret in CI, build and upload the targets.

nsgo build -channel none -installers=false -target web,macos_arm64
nsgo publish itch -target web,macos_arm64

Use the same -output and -version on both commands if you override them. The upload takes each target’s package directory and sets its itch.io version to the build’s version. NSGo uses butler on PATH or downloads a pinned copy from itch.io into the shared download cache. nsgo fetch does not list Butler: it is a publishing tool selected for the host, not a packaging download for the target. After the first web upload, set the itch.io game type to HTML and mark the upload playable in the browser. Butler documentation

updates has the app keep itself up to date the way its platform and the channel users get it from do:

updates:
key: zE0hx2FZwwHy6X7LbEP3GjTTE3KWfCAp5gsaBysC+vg= # the public key nsgo keygen prints
# channel: store # direct, store, steam or none; direct by default with a key, none without
# feed: https://example.com/hello/ # where the appcasts and installers are; by default the latest GitHub release
# automatic: false # check only when asked; true by default
# automatic_downloads: true # Sparkle downloads automatically; false by default, macOS only
# interval: 6h # how long automatic checks leave between them, an hour at least; a day by default

nsgo keygen prints a key pair and writes no file: put the public key in updates.key and commit it, and keep the secret one out of the repository, in a password manager and in NSGO_UPDATES_KEY where releases build, such as a GitHub Actions secret. Each direct build signs the installers with the secret key and writes appcast-<target>.xml beside them, a feed in Sparkle’s format that the app reads under feed: upload the appcasts with the installers. Without the secret key, build writes no macOS or Windows appcast, as those install only signed installers, and Linux and Android apps reading an unsigned appcast open the release’s page instead of installing its package.

-release-notes notes.md puts a Markdown file of the release’s notes, such as its changelog section, into each appcast, rendered as HTML without the file’s own raw HTML. Sparkle and WinSparkle show it in their update dialogs, and the prompt on Linux and Android shows it as text below the version, up to 1,500 characters; apps read it as core.UpdateCheck.Notes.

-release-channel beta marks the release’s appcast items with sparkle:channel, so only users who opted into beta with updater.SetChannel are offered it; everyone else keeps getting the releases without a channel, as Sparkle does. Windows, whose WinSparkle reads no channel, gets the channel’s own appcast instead, appcast-<target>-beta.xml beside appcast-<target>.xml, and reads it once the user opted in, from the next launch. The build writes each release’s appcast alone, so a channel needs a feed you maintain: merge the channel’s items into the target’s appcast for macOS, Linux and Android, and keep the default stream’s releases in the Windows channel’s appcast too, so beta users still get a newer stable release.

-phased-rollout 24h rolls the release out to seven groups of installations, one more group each interval after the item’s pubDate, as Sparkle’s sparkle:phasedRolloutInterval does: automatic checks on macOS, Linux and Android wait for their group, and a manual updater.Check gets the release at once. WinSparkle has no phased rollouts, so Windows offers it to everyone.

Target How a direct build updates
macOS Sparkle, which build puts into the app, checks daily, offers the new version, downloads the disk image, checks its signature, installs it and restarts the app; the default app menu has Check for Updates…, which an app setting its own menu adds with updater.Check
Windows WinSparkle, beside the executable, does the same in the language the app shows as it starts, when WinSparkle has it, and runs the installer silently, which starts the new version
Linux, Android The app reads its appcast, and once the user chooses Update streams and verifies the signed package directly to disk with progress reported (updater.Status and the platform task progress indicator), then installs it through pkexec dpkg, pkexec pacman (.pkg.tar.gz/.pkg.tar.zst), atomic AppImage replacement (restarting on Linux), or Android’s package installer; installs outside those formats or an unsigned appcast offer the release’s page instead
iOS The app asks the App Store, which updates it, and offers its page there

For a published standalone web app, updater.Check(cx) compares the running release with a fresh nsgo.json and offers to reload after confirmation. It also notices changed build files under the same version label. It needs no appcast key; explicit none/steam channels still disable checks, and embedded hosts manage their own reloads. Mini programs use their platform’s update manager and restart only once the downloaded update is ready. These targets check when the app calls the updater; mini-program download/check timing belongs to the host. They expose no automatic-check preference setters. A custom cx.CheckForUpdates handler uses UpdateCheck.Restart for a prepared update whose version label may be absent.

The channel decides who updates the app. -channel replaces updates.channel for one build, so one project builds for each:

Channel For The packages
direct GitHub, a website, Homebrew casks and winget, which install the release’s own files Update themselves as above
store The App Store, the Mac App Store, the Microsoft Store, Google Play, Flathub and other stores Are the store packages and carry no self-updater; iOS and macOS ask their App Store without a key, and a Google Play install can use Play’s native update flow
steam Steam Produce depot directories that Steam updates
none Linux distributions and anyone who repackages the app Check nothing

Stores reject apps that update themselves, so upload a store build, never a direct one. Each direct release with macOS or Windows installers also writes a Homebrew cask (dist/releases/homebrew/<name>.rb, declaring auto_updates true, checksums and download URLs for the built disk images, and a binary link to each of the app’s commands) and a winget multi-file manifest (dist/releases/winget/<id>.yaml, <id>.installer.yaml and <id>.locale.en-US.yaml for the built NSIS installers). Wherever the system tells who installed the app, the app checks that too: an Android app from another store, a Flatpak or Snap, and a TestFlight build leave updates to that store. A manual updater.Check in a Google Play install asks Play In-App Updates to offer its immediate flow when allowed; Play handles consent, downloading, installation and restart. Development builds never enter that flow. Standalone Android packages bundle the SDK; embedding hosts supply it through Gradle.

updater.Check(cx) checks as a Check for Updates… menu item does, and shows what it finds; updater.CheckInBackground(cx) shows only a newer version, and updater.CheckDaily(cx) does that at most once a day, or once each updates.interval, which also paces Sparkle and WinSparkle. updater.Status(cx) reads the live download and install progress on Linux and Android. While automatic is on, the app checks that way on Linux, direct Android builds and Apple App Store builds as it starts and whenever the user comes back to it; a check that fails, as one offline does, is tried again an hour later. Development builds never update. In Steam builds, these three functions do nothing.

updater.CapabilityOf(cx) reports how this copy updates without a network request: ManagedSelf, ManagedPage, ManagedDevelopment, ManagedChannel, ManagedStore (with its Store name), or ManagedUnavailable. A development build, disabled channel or store installation produces a reason-specific explanation when checked; core.UpdateCheck.Err is reserved for failures such as a bad feed or a bundled updater that cannot load.

Read updater.Status(cx) inside a binding to follow Capability, AutomaticChecks, AutomaticDownloads, Channel, Available, Notes and LastCheck, and on Linux and Android an update’s Phase, Loaded and Total (Fraction() for a progress bar). updater.SetAutomaticChecks(cx, on) persists the user’s choice and changes the daily scheduler at runtime. Sparkle and WinSparkle own their preferences; Linux, Android and iOS keep the choice in a private storage partition. updater.SetAutomaticDownloads(cx, on) is supported only on macOS, defaulting to updates.automatic_downloads; other platforms report false and ignore the setter. Unsupported and externally managed builds report both settings false. updater.SetChannel(cx, "beta") opts the user into a release channel, and "" back to the default stream; it takes the same names as -release-channel and logs and ignores any other. Sparkle keeps it in the app’s user defaults, WinSparkle in its registry key, and Linux and Android in the private partition; store, development, disabled and Apple App Store builds ignore it and report "". WinSparkle reports found-update metadata by reading the appcast after its found callback; it still controls installation. Linux resolves Debian or Arch package ownership and AppImage identity at launch; those copies report ManagedSelf, while other unpackaged copies report ManagedPage before any check.