Skip to main content

Environment Variables

electron-builder reads a handful of environment variables — almost all of them secrets (signing certificates, publish tokens) or CI-provided values (the release tag, repository slug). Everything else is configured through your configuration file, not the environment.

This page is a grouped reference for every environment variable electron-builder itself reads. For the deeper "how", each group links to the relevant guide.

Upgrading from v26?

Several environment variables were removed in v27 — most notably CI_BUILD_TAG (use CI_COMMIT_TAG), ALLOW_ELECTRON_BUILDER_AS_PRODUCTION_DEPENDENCY, and every toolset-override variable (USE_SYSTEM_WINE, ELECTRON_BUILDER_NSIS_DIR, …). See Removed in v27 below and the v27 breaking changes.


Code signing​

Signing credentials are read from the environment so certificates and passwords never have to live in your config. Never commit them to source control — inject them via CI secrets. Each value accepts an HTTPS URL, a file:// path, a local path, or a base64-encoded certificate string.

Shared / macOS​

VariableDescription
CSC_LINKThe certificate (.p12/.pfx) — HTTPS URL, file:// path, local path, or base64 string.
CSC_KEY_PASSWORDPassword that decrypts the certificate at CSC_LINK.

macOS installer (PKG)​

VariableDescription
CSC_INSTALLER_LINKCertificate for signing PKG installers (a Developer ID Installer certificate).
CSC_INSTALLER_KEY_PASSWORDPassword for the installer certificate.

Windows​

VariableDescription
WIN_CSC_LINKWindows certificate. Falls back to CSC_LINK if unset.
WIN_CSC_KEY_PASSWORDPassword for the Windows certificate. Falls back to CSC_KEY_PASSWORD if unset.
Cross-compiling Windows on macOS

Use WIN_CSC_LINK / WIN_CSC_KEY_PASSWORD to supply a separate Windows certificate while keeping your macOS certificate in CSC_LINK / CSC_KEY_PASSWORD.

More signing variables

The macOS keychain/identity variables (CSC_NAME, CSC_IDENTITY_AUTO_DISCOVERY, CSC_KEYCHAIN) and Azure Trusted Signing variables (AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET) are documented in the code-signing guides: Code Signing, macOS, and Windows. In v27, WIN_CSC_LINK fallback applies only to signtool mode; hsm, pkcs11, and azure are configured through win.sign.

Notarization (macOS)​

For notarizing macOS apps distributed outside the Mac App Store. Provide one of the three credential sets. Full setup is in the Notarization guide.

VariableDescription
APPLE_IDApple ID email (Apple-ID auth).
APPLE_APP_SPECIFIC_PASSWORDApp-specific password for that Apple ID.
APPLE_TEAM_IDApple Developer Team ID.
APPLE_API_KEYPath to the App Store Connect API key (.p8).
APPLE_API_KEY_IDKey ID for the App Store Connect API key.
APPLE_API_ISSUERIssuer ID for the App Store Connect API key.
APPLE_KEYCHAINKeychain to search for a stored notarization profile.
APPLE_KEYCHAIN_PROFILEName of a notarytool keychain profile to use.

Publishing​

Publish providers read their credentials from the environment. Publishing is never automatic — you must pass --publish explicitly (see Publish).

GitHub​

VariableDescription
GH_TOKEN / GITHUB_TOKENGitHub token. If either is defined, publishing defaults to [{ provider: "github" }].
GITHUB_RELEASE_TOKENIf defined, used instead of GH_TOKEN/GITHUB_TOKEN to publish the release (so you can keep a read-only token for update checks and a read-write token for releasing).

GitLab​

VariableDescription
GITLAB_TOKENGitLab token. Required to publish to the gitlab provider.

Bitbucket​

VariableDescription
BITBUCKET_TOKENBitbucket token. Required to publish to the bitbucket provider.
BITBUCKET_USERNAMEBitbucket username / Atlassian account email — selects the auth scheme (see below).
v27 auth change

In v27 the Bitbucket publisher selects its auth scheme by whether a username is present:

  • BITBUCKET_USERNAME set → HTTP Basic auth. Use this for an app password or an Atlassian API token.
  • No username → the token is sent as Authorization: Bearer <token> (a repository / project / workspace access token).

If BITBUCKET_TOKEN holds an app password or API token, you must also set BITBUCKET_USERNAME. See the breaking-change note.

Keygen​

VariableDescription
KEYGEN_TOKENKeygen token. If defined (and no GitHub token is), publishing defaults to [{ provider: "keygen" }].

Cloudflare R2​

VariableDescription
CF_R2_ACCESS_KEY_IDR2 access key ID (an R2 API token with Object Read & Write).
CF_R2_SECRET_ACCESS_KEYR2 secret access key.

Amazon S3​

VariableDescription
AWS_ACCESS_KEY_IDAWS access key ID.
AWS_SECRET_ACCESS_KEYAWS secret access key.
AWS_SESSION_TOKENOptional session token for temporary credentials.
AWS_PROFILENamed profile in ~/.aws/credentials to use when the keys above are not set (default: default).

DigitalOcean Spaces​

VariableDescription
DO_KEY_IDSpaces access key ID.
DO_SECRET_KEYSpaces secret access key.

Snap Store​

VariableDescription
SNAP_CSC_LINKBase64-encoded Snap Store credentials or a file path (the CI-friendly equivalent of snapcraft.cscLink). Used for Snap Store publishing and Launchpad remote builds.
SNAPCRAFT_STORE_CREDENTIALSPlain-text macaroon, read directly by snapcraft.

See Snap → Authentication for the credential resolution order.


CI and release tags​

electron-builder detects the release tag and repository from standard CI variables. These are normally set by your CI provider, not by you — the exception is CI_COMMIT_TAG, which you can set manually (e.g. on GitLab or self-hosted CI) to provide the tag.

VariableDescription
CI_COMMIT_TAGThe release tag (GitLab's standard variable). Set this manually where no other tag variable is present.
TRAVIS_TAGTag on Travis CI.
APPVEYOR_REPO_TAG_NAMETag on AppVeyor.
CIRCLE_TAGTag on CircleCI.
BITRISE_GIT_TAGTag on Bitrise.
BITBUCKET_TAGTag on Bitbucket Pipelines.
GITHUB_REF_TYPE / GITHUB_REF_NAMEOn GitHub Actions, the tag is taken from GITHUB_REF_NAME when GITHUB_REF_TYPE is tag.

The GitHub repository is auto-detected from TRAVIS_REPO_SLUG, APPVEYOR_REPO_NAME, or CIRCLE_PROJECT_USERNAME/CIRCLE_PROJECT_REPONAME (falling back to your package.json repository field or .git/config).

CI_BUILD_TAG removed in v27

CI_BUILD_TAG was removed — use CI_COMMIT_TAG instead. See the breaking-change note.


Cache & download​

VariableDescription
ELECTRON_BUILDER_CACHEOverrides the cache directory used for downloaded Electron binaries and toolsets. Must be an absolute path. Defaults to ~/Library/Caches/electron-builder (macOS), %LOCALAPPDATA% (Windows), or $XDG_CACHE_HOME / ~/.cache (Linux).
USE_HARD_LINKSSet to "true" to copy files via hard links where possible (faster, less disk use). Ignored on Windows.
Electron mirror is config, not an env var

To download Electron from a mirror, configure electronGet.mirrorOptions in your build config — e.g. electronGet: { mirrorOptions: { mirror: "https://my-mirror/" } }. (In v26 this was electronDownload.mirror.) See Configuration.


Debugging​

VariableDescription
DEBUG=electron-builderEnables verbose debug logging via the debug package.
DEBUG=electron-builder electron-builder --linux snap

Namespaced channels are also available — e.g. DEBUG=electron-builder:7z for archive operations, or DEBUG=electron-builder* for everything.


Removed in v27​

These variables were removed in v27. electron-builder migrate-schema does not rewrite them — update your scripts and config manually.

Removed variableReplacement
CI_BUILD_TAGCI_COMMIT_TAG
ALLOW_ELECTRON_BUILDER_AS_PRODUCTION_DEPENDENCYThe ignoredProductionDependencies build option — see the breaking-change note.

Toolset overrides​

The environment variables that pointed electron-builder at custom build-tool bundles are all removed. Supply a custom bundle through a ToolsetCustom object on the relevant toolsets key instead (toolsets.<name>: { url, checksum }).

Removed variableWhat it controlled
USE_SYSTEM_WINEForced host-installed Wine instead of the bundle. Replaced by toolsets.wine: "system".
USE_SYSTEM_SIGNCODEForced host signtool/signcode.
USE_SYSTEM_OSSLSIGNCODEForced host osslsigncode.
USE_SYSTEM_FPMForced host-installed fpm.
APPIMAGE_TOOLS_PATHAppImage build tools (mksquashfs, runtime).
LINUX_TOOLS_MAC_PATHLinux-tools-mac bundle (ar, lzip, gtar).
CUSTOM_FPM_PATHFPM executable.
ELECTRON_BUILDER_NSIS_DIRNSIS compiler bundle directory.
ELECTRON_BUILDER_NSIS_RESOURCES_DIRNSIS resources/plugins directory.
CUSTOM_NSIS_RESOURCESAlternate NSIS resources bundle.
ELECTRON_BUILDER_WINE_TOOLSET_DIRWine bundle directory.

The two signing USE_SYSTEM_* variables (USE_SYSTEM_SIGNCODE, USE_SYSTEM_OSSLSIGNCODE) have no env-var replacement — configure signing through win.sign and the winCodeSign toolset. For the full replacement mechanics (archive formats, checksums, file:// directories), see Toolset env-var overrides removed.