The CLI
Install updater-cli, and every command and flag it has for publishing releases, module releases and distributions.
updater-cli publishes to the Updater: releases with their artifacts, module
releases, and distributions. It is built for CI. For a first pipeline, start
with Publish from CI.
Install
curl -fsSL https://updater.xeonr.io/77/install.sh | shOn Windows, in PowerShell:
irm https://updater.xeonr.io/77/install.ps1 | iexupdater-cli is published through its own Updater app, so these need no credential. Builds exist for Linux, macOS and Windows on amd64 and arm64, and the script verifies the published checksum before installing. In CI, pin a version so a new release cannot change a pipeline under you:
curl -fsSL https://updater.xeonr.io/77/install.sh | UPDATER_CLI_VERSION=1.2.6 shUPDATER_CLI_INSTALL_DIR chooses where it lands.
The npm package @xeonr/updater-cli is no longer published and stops at
1.2.5. Install with the script instead, and replace an
npm install -g @xeonr/updater-cli step with it. Older versions on npm still
install, but get no fixes.
updater-cli --version prints the version you have, and updater-cli upgrade
updates it in place.
Connecting
Every command except upgrade needs three settings. Each is a global flag, or
the environment variable beside it; the flag wins. Global flags may come before
or after the command's name.
| Flag | Variable | Value |
|---|---|---|
--api-url | UPDATER_API_URL | https://updater.xeonr.io |
--token | UPDATER_TOKEN | A team API key, xk_…, or a person's Xeonr Auth access token for the Updater |
--bucket-id | UPDATER_BUCKET_ID | The app's bucket id |
Prefer the variables in CI, so the key stays out of the command line and the job log.
Commands
updater-cli config | The app's name, branches and targets |
updater-cli publish | Create a release, upload its artifacts and publish it |
updater-cli publish-module | The same for a module release |
updater-cli distribution list | The app's installers and store links |
updater-cli distribution publish | Upload an installer, creating its entry if needed |
updater-cli distribution link | Add a link to a store listing |
updater-cli upgrade | Replace this binary with a newer release |
distribution can be shortened to dist.
config
Prints the app's name, then each branch with its id and whether its versions
are semver or freeform, then each target with its id, branch and whether it is
public or private. Names and ids from here are what the other commands'
--branch and --targets take.
publish
updater-cli publish --version 1.4.0 --branch stable [flags]Scans a directory, creates the release as a draft, uploads and confirms each artifact, then publishes it.
| Flag | Default | |
|---|---|---|
--version | The release's version, such as 1.4.0. Required. | |
--branch | A branch name or id. Required. | |
--targets | every target on the branch | Comma-separated target names or ids |
--dir | ./dist | Where the artifacts are |
--kind | electron | electron for electron-builder output, binary for plain executables |
--app | the app's name, slugified | --kind binary only: the <app> in the artifacts' filenames |
--notes | Release notes, as Markdown | |
--notes-file | Read the notes from a file. Wins over --notes. | |
--auto-notes | off | Write the notes from the commits since the previous release |
--draft | off | Stop before publishing, and leave the release as a draft |
--modules | Comma-separated ids of modules this release requires | |
--commit | git rev-parse HEAD | The commit the release was built from |
--repo-url | the origin remote | The repository's browse URL. SSH and .git remotes are turned into an https:// URL. |
Artifacts. With --kind electron, the CLI files each file by its
extension: .dmg and mac .zip under darwin, .exe under win32,
.nupkg and RELEASES under win32-squirrel, and .AppImage, .deb,
.rpm and .snap under linux. It uploads .blockmap files beside their
artifact and ignores electron-builder's .yml files.
With --kind binary, it picks up <app>-<goos>-<goarch> binaries and
<app>_<version>_<goos>_<goarch>.tar.gz (or .zip) archives, as described in
Distribute a CLI. It
skips files named for another app, ignores .sha256 and checksums.txt
files, and stops if an archive is for a different version. The SHA-256 of each
binary is printed as it uploads.
A release holds one kind. A directory that mixes the two is refused.
Running it again. A publish of a version the branch already has does not start over:
- If that version is a draft, such as one a failed run left, the CLI resumes it. Files already uploaded with the same contents are skipped, and the rest are uploaded before it publishes. A file of the same name with different contents stops the run.
- If it is already published from the same commit, the CLI says so and exits successfully, so a re-run job is harmless.
- If the existing release was built from a different commit, or was published and then rescinded, the run stops. Publish a new version.
The commit is compared only when both sides have one (see --commit).
Auto notes. --auto-notes applies only when no other notes were given. It
finds the newest published release on the same branch that shares a target
with this one and was built from a different commit, or failing that the
newest git tag on another commit. It then groups the commit subjects in
between by their conventional-commit prefix:
## Features
- a new export format
## Bug Fixes
- the progress bar no longer stalls at 99%feat!: and BREAKING CHANGE go under Breaking Changes, feat under
Features, fix under Bug Fixes, perf under Performance, and anything without
a prefix under Other. chore, ci, docs, style, refactor, test and
build commits are left out. The job needs the git history for this, so in
GitLab set GIT_DEPTH: 0.
publish-module
updater-cli publish-module --module <module-id> --version 2.1.0 --branch stable --file 'dist/*.zip'| Flag | |
|---|---|
--module | The module's name or id. Required. |
--version | The module release's version. Required. |
--branch | A branch name or id. Required. |
--targets | Comma-separated target names or ids. Default: every target on the branch. |
--file | The module's ZIP. A glob such as 'dist/*.zip' uploads every match. Required. |
--platform | darwin, win32, linux or universal. Default: read from each filename, else universal. |
--min-base-version | The oldest app version this module release works with |
--notes | Release notes |
--draft | Leave it as a draft |
Quote a glob so the shell passes it through. Without --platform, a filename
containing darwin or mac is darwin, one containing win is win32, and
one containing linux is linux.
distribution
Distributions are ways to get the app that are not part of a release: an installer that sets things up before installing, or a link to an app store listing. They change less often than the app, so they are published on their own.
updater-cli distribution list# The first time: creates the entry, then uploads the file.
updater-cli distribution publish --label "Windows installer" --platform win32 --version 1.0.0 --file dist/setup.exe
# After that: replaces the file and keeps the entry and its download URL.
updater-cli distribution publish --id <distribution-id> --version 1.0.1 --file dist/setup.exedistribution publish flag | |
|---|---|
--file | The file to upload. Required. |
--id | The entry to upload into. Without it, a new entry is created. |
--label | Its label, such as Windows installer. Required when creating. |
--platform | darwin, win32, linux, ios, tvos, android, androidtv or other. Required when creating. |
--version | The version shown beside the label |
--targets | Comma-separated target names. Default: every target. Used when creating. |
--private | Leave it off the public download page. Used when creating. |
updater-cli distribution link --label "App Store" --platform ios --url https://apps.apple.com/app/id000000000distribution link takes --label, --platform and --url, all required,
plus --targets and --private as above. Nothing is hosted; the download page
links to the listing.
upgrade
updater-cli upgradeReplaces the running binary with the newest release of updater-cli from its Updater app, after checking the download against the published checksum. An install from npm is better upgraded with npm.
| Flag | |
|---|---|
--app-url | The app to upgrade from. Default https://updater.xeonr.io/77, or UPDATER_SELF_APP_URL. |
--target | The target to follow. Default stable, or UPDATER_SELF_TARGET. |
--prerelease | Follow the prerelease target instead |
--check | Only report whether a newer version exists |
--force | Reinstall even when already up to date |
Errors
| Message | Meaning |
|---|---|
--token or UPDATER_TOKEN is required | A connection setting is missing. The same message names --api-url and --bucket-id. |
app <id> not found | The key's team does not own that app, or the bucket id is wrong |
this API key is not bound to app <id> | The key is bound to other apps |
permission_denied: permission denied | The key was used on a method only a signed-in person may call. See Authentication. |
branch "<name>" not found, target "<name>" not found | Check the names with updater-cli config |
no targets found for branch … | The branch has no targets to publish to. Add one in the console. |
no binary artifacts found in dist | Nothing in --dir matched. For --kind binary, check --app against the filenames. |
… is an archive of version …, not … | A stale build is in --dir |
a draft of v<v> from commit <a> exists and this build is <b> | A draft of this version came from another build. Delete the draft in the console, or publish a new version. |
the draft of v<v> already holds a different <file> | The draft being resumed has a file of that name with other contents |
v<v> is already published from commit <a>, and this build is <b> | Publish a new version |
v<v> was published and then rescinded | Publish a new version |
module "<name>" not found | Check the module's name or id in the console |