enable_auto_updates(
"path/to/app",
provider = "github",
owner = "your-username",
repo = "your-app-repo"
)Auto-updates ship by publishing a signed artifact and a matching latest.yml to a place the app knows to check. shinyelectron wires your project up to electron-updater, which does the checking, downloading, and swap-on-quit.
GitHub Releases and Generic HTTP are supported. S3 is planned and not yet wired into the build.
| Provider | Status | Best for | Requirements |
|---|---|---|---|
| GitHub Releases | Supported | Open source projects | Public or private GitHub repo |
| S3 | Planned | Enterprise deployments | AWS S3 bucket |
| Generic HTTP | Supported | Custom infrastructure | Any HTTP server |
Point the app at a GitHub repo and re-export. Everything else follows from configuration.
enable_auto_updates(
"path/to/app",
provider = "github",
owner = "your-username",
repo = "your-app-repo"
)enable_auto_updates() writes the settings to _shinyelectron.yml. Verify them at any time with:
check_auto_update_status("path/to/app")GitHub Releases is the default, and the right choice for most open-source projects.
Tell the app where to look, and choose whether it prompts the user before downloading.
enable_auto_updates(
"path/to/app",
provider = "github",
owner = "myorg",
repo = "my-shiny-dashboard",
check_on_startup = TRUE,
auto_download = FALSE # Prompt user before downloading
)Build as usual.
export("path/to/app", destdir = "build")v1.0.0.my-app:
my-app-1.0.0-arm64.dmg and my-app-1.0.0-x64.dmg (macOS)my-app-Setup-1.0.0-x64.exe (Windows)my-app-1.0.0-x86_64.AppImage (Linux)latest-mac.yml (macOS update manifest)latest.yml (Windows update manifest)latest-linux.yml (Linux update manifest)Note
Upload the files under the names electron-builder gave them. electron-updater downloads the file that
latest.yml,latest-mac.yml, orlatest-linux.ymlnames. Those names are built from the app’s slug, version, and architecture (<slug>-<version>-<arch>.<ext>, withSetupin the Windows installer’s name), so they are safe to upload to GitHub Releases as they are.
On the next launch, a version higher than the installed one triggers the update cycle:
check_on_startup = TRUE.auto_download = TRUE, otherwise on consent.Users can also check at any time from Help > About > Check for Updates on Windows and Linux, which reports the result in a dialog. The button is left out on macOS, where a build ships only a disk image and electron-updater needs a zip archive to update the app.
See what the app says when an update exists, without publishing a release. Export with updates on, then run the app against a local feed that offers a higher version.
export("path/to/app", destdir = "build")
run_electron_app("build/electron-app", update_version = "2.0.0")Any provider works. For this run the app checks a feed served on 127.0.0.1 instead of the host in its configuration.
With a version above the app’s, the startup notice appears (with check_on_startup = TRUE, the default), and on Windows and Linux Help > About > Check for Updates answers “Version 2.0.0 is available” (with auto_download = TRUE, both say the version “is downloading” instead). With a version at or below the app’s, Check for Updates answers “You are up to date”. macOS shows only the startup notice, since the button is left out there.
Download in the Check for Updates dialog fails with “Could not download the update”, and a download started from the startup notice fails without a message and is only written to the log. That is expected: the feed offers a version but holds no installer. To try the download and the install as well, rehearse an update locally.
The run writes dev-app-update.yml into the app folder and removes it when the run ends, even after an error or Ctrl+C. If the folder already holds a dev-app-update.yml of your own, the run stops and leaves that file as it is.
The full updates block in _shinyelectron.yml:
updates:
enabled: true
provider: "github" # or "generic"
check_on_startup: true # Check when app starts
auto_download: false # Download without prompting
auto_install: false # Install on app quit
github: # Read with provider: "github"
owner: "your-username"
repo: "your-repo"
private: false # Set true for private repos
generic: # Read with provider: "generic"
url: "https://updates.example.com/my-app/"Three flags drive three stages. check_on_startup asks whether an update exists. auto_download fetches it. auto_install applies it on quit.
| Setting | Behavior |
|---|---|
check_on_startup: true |
Checks for updates when app launches |
auto_download: true |
Downloads updates silently in the background |
auto_install: true |
Installs the update when the user quits the app |
Sensible default: check automatically, but let the user choose when to download and restart.
updates:
check_on_startup: true
auto_download: false # Let user decide
auto_install: false # Let user decide when to restartSecurity patches and regressions benefit from the aggressive posture:
updates:
check_on_startup: true
auto_download: true # Download immediately
auto_install: true # Install on next quitPrivate repos require a token in the user’s environment.
updates:
github:
owner: "my-org"
repo: "private-app"
private: trueExport GH_TOKEN before launch.
# macOS/Linux
export GH_TOKEN=ghp_xxxxxxxxxxxx
# Windows
set GH_TOKEN=ghp_xxxxxxxxxxxxApps opened from Finder, the Dock, or the Start menu do not see a variable set this way in a terminal; see Secrets and per-user credentials for how environment variables reach a launched app.
Important
S3 is planned but not yet supported.
enable_auto_updates()accepts"github"and"generic"as the provider, and with updates on,provider: "s3"in_shinyelectron.ymlstops the build with a message. This section documents the intended design for when S3 support is added.
Point at a bucket for enterprise distribution.
updates:
enabled: true
provider: "s3"
s3:
bucket: "my-app-updates"
region: "us-east-1"
path: "/releases"The bucket should mirror the pattern GitHub Releases produces: per-platform manifests beside the installers.
my-app-updates/
└── releases/
├── latest.yml # Update manifest
├── latest-mac.yml # macOS manifest
├── latest-linux.yml # Linux manifest
├── my-app-1.0.0-arm64.dmg
├── my-app-Setup-1.0.0-x64.exe
└── my-app-1.0.0-x86_64.AppImage
AWS credentials come from the environment.
export AWS_ACCESS_KEY_ID=xxx
export AWS_SECRET_ACCESS_KEY=xxxAnything that can serve static files works. Point the app at the folder that will hold the update files.
enable_auto_updates(
"path/to/app",
provider = "generic",
url = "https://updates.example.com/my-app/"
)Export as usual, then upload to that folder, side by side, the latest*.yml files from electron-app/dist/, the installers they name, and the .blockmap files when the build produced them. On each check the app reads one manifest from the address: latest.yml on Windows, latest-mac.yml on macOS, latest-linux.yml on Linux, or latest-linux-arm64.yml on 64-bit ARM Linux. On Windows and Linux it then downloads the installer that manifest names from the same folder; a Mac shows the notice but cannot install from a disk image (see What the user sees).
Use an https:// address. An http:// address warns unless the host is localhost or 127.0.0.1, because anyone on the network could change what the app downloads; see Security. The address must also hold no backslash or space, as Configuration explains.
The address is written into the app when you export, so export again after changing it.
On Windows and Linux you can try a whole update, download and install included, against a newer build served from your own machine. macOS is left out because a build ships only a disk image, as What the user sees explains. The rehearsal does not use the feed from Try the update check locally, which holds no installer.
Point the app at your machine and export it with app.version at "1.0.0", the default.
enable_auto_updates("path/to/app", provider = "generic", url = "http://127.0.0.1:8080/")
export("path/to/app", destdir = "build-1.0.0")Install it from build-1.0.0/electron-app/dist/. On Linux, start the AppImage file itself, since the updater works only in an app started from its AppImage. An AppImage needs FUSE 2 to start, which recent Ubuntu releases do not install by default: if it stops with “AppImages require FUSE to run”, install the libfuse2t64 package (libfuse2 on Ubuntu 22.04) and start it again. Then set app.version to "1.1.0" in _shinyelectron.yml and export into another folder. Build both versions the same way, signed or not, since on Windows a signed 1.0.0 accepts only an update signed by the same publisher.
export("path/to/app", destdir = "build-1.1.0")Serve that build’s electron-app/dist/ folder on 127.0.0.1 at port 8080 with a static file server. On a machine with Node.js, one way is npx, run from the folder that holds build-1.1.0; the command is the same in PowerShell and in a Unix shell. -a keeps the server to your own machine, -p sets the port, and -c-1 turns off caching.
npx --yes http-server build-1.1.0/electron-app/dist -a 127.0.0.1 -p 8080 -c-1If PowerShell refuses to run npx because running scripts is disabled, type npx.cmd in its place.
In the installed 1.0.0 app, choose Help > About > Check for Updates. It answers “Version 1.1.0 is available”; choose Download. When the download finishes, the app asks to restart; choose Restart to install 1.1.0. Then stop the server with Ctrl+C.
Uninstall the rehearsal build afterwards (on Linux, delete its AppImage). It keeps asking http://127.0.0.1:8080/ for updates at every launch, and any program on that machine that listens on port 8080 could offer it one. Before shipping, set the real https:// address with enable_auto_updates() and export again.
Warning
Unsigned apps trigger Gatekeeper and SmartScreen warnings. Sign production builds.
Supply a certificate, its password, and an Apple ID for notarization.
export CSC_LINK=/path/to/certificate.p12
export CSC_KEY_PASSWORD=your-password
export APPLE_ID=your@email.com
export APPLE_APP_SPECIFIC_PASSWORD=xxxx-xxxx-xxxx-xxxxA PFX certificate and password are enough.
export CSC_LINK=/path/to/certificate.pfx
export CSC_KEY_PASSWORD=your-passworddisable_auto_updates("path/to/app")Or edit the config directly.
updates:
enabled: falseSymptom: “Error checking for updates.”
url address in a browser, such as https://updates.example.com/my-app/latest.yml.GH_TOKEN is set.Symptom: the update arrives but the app does not swap in on restart.
Symptom: the app never sees a newer version.
package.json version must match the release tag.latest*.yml manifests list.latest*.yml files at the url address must be the new build’s.Turn on verbose logs.
export ELECTRON_ENABLE_LOGGING=1Logs land per platform, in a folder named after the app’s slug:
~/Library/Logs/{slug}/%USERPROFILE%\AppData\Roaming\{slug}\logs\~/.config/{slug}/logs/The same tag that cuts a release can build every installer. A minimal workflow:
name: Release
on:
push:
tags: ['v*']
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v7
- name: Setup R
uses: r-lib/actions/setup-r@v2
- name: Build app
run: |
Rscript -e "shinyelectron::export('app', destdir = 'build')"
- name: Upload to Release
uses: softprops/action-gh-release@v3
with:
files: build/electron-app/dist/*See the GitHub Actions vignette for the full template.
_shinyelectron.yml.