| enable_auto_updates | R Documentation |
Configures automatic update checking for your Electron application. GitHub Releases and generic HTTP servers are supported. An S3 provider is planned and will be added in a future release.
enable_auto_updates(
appdir,
provider = "github",
owner = NULL,
repo = NULL,
url = NULL,
check_on_startup = TRUE,
auto_download = FALSE,
auto_install = FALSE,
verbose = TRUE
)
appdir |
Character path to app directory containing |
provider |
Character update provider: |
owner |
Character GitHub username or organization (required for github provider) |
repo |
Character GitHub repository name (required for github provider) |
url |
Character address of the folder that holds the update files
(required for the generic provider). It must start with |
check_on_startup |
Logical whether to check for updates when app starts. Default |
auto_download |
Logical whether to download updates automatically. Default |
auto_install |
Logical whether to install updates automatically on quit. Default |
verbose |
Logical whether to show progress messages. Default |
Auto-updates require:
A published application (e.g., to GitHub Releases)
Proper code signing for macOS and Windows (recommended)
The electron-updater package (automatically included in build)
GitHub Releases (recommended for open source):
Automatically detects new releases by comparing semver tags
Requires owner and repo parameters
Private repos require GH_TOKEN environment variable
S3 Bucket (planned, not yet supported):
For self-hosted updates behind a CDN
Configure bucket, region, and path in _shinyelectron.yml
Bucket must allow public reads or use CloudFront signed URLs
Required bucket structure: /{path}/latest-mac.yml, latest-linux.yml, latest.yml
Note: enable_auto_updates() currently rejects "s3" as a provider;
S3 support will be added in a future release.
Generic HTTP Server:
For any static web server hosting the update files
Requires the url parameter: the folder that holds the files, saved as
updates.generic.url in _shinyelectron.yml
Upload the latest*.yml files from destdir/electron-app/dist/, the
installers they name, and any .blockmap files beside them, side by
side in that folder
Use https://; an http:// address warns unless the host is
localhost or 127.0.0.1
After enabling auto-updates, follow this workflow to publish updates:
Bump version in _shinyelectron.yml (e.g., version: "1.1.0")
Rebuild with export(appdir, destdir, build = TRUE)
Create a GitHub Release with a semver tag matching the version:
Tag: v1.1.0 (the v prefix is required)
Upload the built artifacts from destdir/electron-app/dist/:
macOS: .dmg and latest-mac.yml
Windows: .exe installer and latest.yml
Linux: .AppImage and latest-linux.yml
The app checks for updates on startup (if check_on_startup = TRUE)
and notifies the user when a new version is available
Signing is what lets an app check who published an update. A signed
Windows app installs only an update signed by the same publisher; an
unsigned one, like a Linux AppImage, installs whatever the update address
serves, so it trusts that server (and, over http://, the network)
completely. Set signing: sign: true in your config and provide
credentials via environment variables (see ?validate_signing_config).
Invisibly returns the path to the updated config file.
init_config() for creating initial configuration
# Enable GitHub-based updates on a temporary app
app <- file.path(tempdir(), "enable-updates-demo")
dir.create(app, showWarnings = FALSE)
writeLines("library(shiny)", file.path(app, "app.R"))
enable_auto_updates(app, owner = "myusername", repo = "myapp")
# Enable with automatic download
enable_auto_updates(app, owner = "myorg", repo = "dashboard",
auto_download = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.