Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/disable-implicit-publish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"app-builder-lib": major
---

fix: disable implicit publishing by default

BREAKING CHANGE: Publishing no longer happens automatically based on CI environment, git tags, or npm lifecycle events. You must now explicitly request publishing using the `--publish` CLI flag (e.g., `--publish always`, `--publish onTag`) or by setting the `publish` option in your configuration.

This addresses security and usability concerns where unexpected auto-publishing could accidentally expose secrets or publish unfinished work.

Fixes electron-userland/electron-builder#5463
16 changes: 0 additions & 16 deletions packages/app-builder-lib/src/publish/PublishManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
} from "electron-publish"
import { MultiProgress } from "electron-publish/out/multiProgress"
import { writeFile } from "fs/promises"
import { isCI } from "ci-info"
import * as path from "path"
import { WriteStream as TtyWriteStream } from "tty"
import * as url from "url"
Expand Down Expand Up @@ -84,21 +83,6 @@ export class PublishManager implements PublishContext {

const forcePublishForPr = process.env.PUBLISH_FOR_PULL_REQUEST === "true"
if (!isPullRequest() || forcePublishForPr) {
if (publishOptions.publish === undefined) {
if (process.env.npm_lifecycle_event === "release") {
publishOptions.publish = "always"
} else {
const tag = getCiTag()
if (tag != null) {
log.info({ reason: "tag is defined", tag }, "artifacts will be published")
publishOptions.publish = "onTag"
} else if (isCI) {
log.info({ reason: "CI detected" }, "artifacts will be published if draft release exists")
publishOptions.publish = "onTagOrDraft"
}
}
}

const publishPolicy = publishOptions.publish
this.isPublish = publishPolicy != null && publishOptions.publish !== "never" && (publishPolicy !== "onTag" || getCiTag() != null)
if (this.isPublish && forcePublishForPr) {
Expand Down
3 changes: 3 additions & 0 deletions pages/publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Note that when using a generic server, you have to upload the built application
Travis and AppVeyor support publishing artifacts. But it requires additional configuration for each CI and you need to configure what to publish.
`electron-builder` makes publishing dead simple.

!!! important "Publishing Must Be Explicitly Requested"
Publishing is not performed automatically. You must explicitly request publishing using the `--publish` CLI flag (e.g., `--publish always`, `--publish onTag`, `--publish onTagOrDraft`) or by setting the `publish` option in your configuration.

If `GH_TOKEN` or `GITHUB_TOKEN` is defined — defaults to `[{provider: "github"}]`.

If `KEYGEN_TOKEN` is defined and `GH_TOKEN` or `GITHUB_TOKEN` is not — defaults to `[{provider: "keygen"}]`.
Expand Down