Publishing Artifacts

develar edited this page Jan 15, 2017 · 8 revisions

Travis and AppVeyor support publishing artifacts. But it requires additional configuration. For each CI (since AppVeyor can build only Windows and Travis only macOS / Linux).

electron-builder allows you to just add GH_TOKEN environment variable and that's all.

Currently, GitHub Releases and Bintray are supported.

CLI --publish option values:

Value Description
onTag on tag push only
onTagOrDraft on tag push or if draft release exists
always always publish
never never publish

But please consider using automatic rules instead of explicitly specifying publish:

  • If CI server detected, — onTagOrDraft.

    NOTICE: This is the recommended workflow.

    1. Draft a new release. Set the "Tag version" to the value of version in your application package.json, and prefix it with v. "Release title" can be anything you want.
      • For example, if your application package.json version is 1.0, your draft's "Tag version" would be v1.0.
    2. Push some commits. Every CI build will update the artifacts attached to this draft.
    3. Once you are done, publish the release. GitHub will tag the latest commit for you.

    The benefit of this workflow is that it allows you to always have the latest artifacts, and the release can be published once it is ready.

  • If CI server reports that tag was pushed, — onTag.

    Release will be drafted (if doesn't already exist) and artifacts published only if tag was pushed.

  • If npm script named release, — always.

    Add to scripts in the development package.json:

    "release": "build"

    and if you run npm run release, a release will be drafted (if doesn't already exist) and artifacts published.

GitHub Repository and Bintray Package

Detected automatically using:

  • repository in the application or development package.json,
  • if not set, env TRAVIS_REPO_SLUG or APPVEYOR_ACCOUNT_NAME/APPVEYOR_PROJECT_NAME or CIRCLE_PROJECT_USERNAME/CIRCLE_PROJECT_REPONAME,
  • if no env, from .git/config origin url.

Publish Options

publish can be specified in the configuration options or any platform- or target- specific options.

"win": {
  "publish": ["github", "bintray"]
}

publish

Can be specified in the build or any platform- or target- specific options.

If GH_TOKEN is set — defaults to [{provider: "github"}]. If BT_TOKEN is set and GH_TOKEN is not set — defaults to [{provider: "bintray"}].

Array of option objects. Order is important — first item will be used as a default auto-update server on Windows (NSIS).

Amazon S3 — https must be used, so, if you use direct Amazon S3 endpoints, format https://s3.amazonaws.com/bucket_name must be used. And do not forget to make files/directories public.

Name Description
provider The provider, one of github, bintray, generic.
owner The owner.

publish Bintray

Name Description
package The Bintray package name.
repo The Bintray repository name. Defaults to generic.
user The Bintray user account. Used in cases where the owner is an organization.

publish Generic (any https server)

Name Description
url The base url. e.g. https://s3.amazonaws.com/bucket_name
channel The channel. Defaults to latest.

publish GitHub

Name Description
repo The repository name. Detected automatically.
vPrefixedTagName Whether to use v-prefixed tag name. Defaults to true.