electron-publish module provides the publishing infrastructure used by electron-builder to upload artifacts to various hosting providers.
Installation
PublishOptions Interface
Options for controlling when to publish artifacts.PublishPolicy | null
When to publish artifacts.
"onTag"- Publish only if building a tagged commit"onTagOrDraft"- Publish on tag or if GitHub release is a draft"always"- Always publish"never"- Never publish
PublishContext Interface
Context provided to publishers.CancellationToken
Token for cancelling upload operations.
MultiProgress | null
Progress bar manager for displaying upload progress.
UploadTask Interface
Represents a file to be uploaded.string
required
Path to the file to upload.
Buffer | null
Optional file content buffer (instead of reading from file path).
Arch | null
Architecture of the artifact (or null if not architecture-specific).
string | null
Safe artifact name for display/logging.
number | null
Upload timeout in milliseconds.
Publisher Classes
Base class and platform-specific publishers for uploading artifacts.Publisher (Abstract)
Abstract base class for all publishers.packages/electron-publish/src/publisher.ts:13
GitHubPublisher
Publishes to GitHub Releases.S3Publisher
Publishes to Amazon S3.SpacesPublisher
Publishes to DigitalOcean Spaces.GitlabPublisher
Publishes to GitLab Releases.BitbucketPublisher
Publishes to Bitbucket Downloads.KeygenPublisher
Publishes to Keygen.SnapStorePublisher
Publishes to Snap Store.HttpPublisher
Publishes to a generic HTTP endpoint.Utility Functions
getCiTag()
Gets the Git tag from CI environment variables.null if not in a tagged build.
Supported CI systems:
- Travis CI (
TRAVIS_TAG) - AppVeyor (
APPVEYOR_REPO_TAG_NAME) - CircleCI (
CIRCLE_TAG) - GitLab CI (
CI_COMMIT_TAG) - GitHub Actions (
GITHUB_REF_NAMEwhenGITHUB_REF_TYPEis βtagβ) - Bitrise (
BITRISE_GIT_TAG) - Bitbucket (
BITBUCKET_TAG)
Example: Custom Publisher
Configuration in electron-builder
Publish configuration is specified in your build configuration:Environment Variables
Publishers use environment variables for authentication:- GitHub:
GH_TOKENorGITHUB_TOKEN - GitLab:
GITLAB_TOKEN - Bitbucket:
BITBUCKET_TOKEN - S3:
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY - Spaces:
DO_TOKEN - Keygen:
KEYGEN_TOKEN - Snap Store:
SNAPCRAFT_STORE_CREDENTIALS