Skip to content

Commit

Permalink
fix(deployment): Artifacts being published to S3 when they shouldn't be
Browse files Browse the repository at this point in the history
Close #2708
  • Loading branch information
develar committed Mar 27, 2018
1 parent cc9f1d6 commit b72b9e8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions packages/electron-builder-lib/src/publish/PublishManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ export class PublishManager implements PublishContext {
return
}

const providerName = publisher.providerName
if (this.publishOptions.publish === "onTagOrDraft" && getCiTag() == null && !(providerName === "GitHub" || providerName === "Bintray")) {
log.info({file: event.file, reason: "current build is not for a git tag", publishPolicy: "onTagOrDraft"}, `not published to ${providerName}`)
return
}

this.taskManager.addTask(publisher.upload(event))
}

Expand Down
4 changes: 3 additions & 1 deletion test/src/PublishManagerTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test.ifDevOrLinuxCi("github and spaces (publishAutoUpdate)", app({
},
}))

test.ifDevOrLinuxCi.ifAll("mac artifactName ", app({
test.ifAll("mac artifactName ", app({
targets: Platform.MAC.createTarget("zip"),
config: {
// tslint:disable-next-line:no-invalid-template-strings
Expand All @@ -65,6 +65,8 @@ test.ifDevOrLinuxCi.ifAll("mac artifactName ", app({
},
]
},
}, {
publish: undefined,
}))

// otherwise test "os macro" always failed for pull requests
Expand Down
2 changes: 1 addition & 1 deletion test/src/helpers/packTester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export function getFixtureDir() {
async function packAndCheck(packagerOptions: PackagerOptions, checkOptions: AssertPackOptions) {
const cancellationToken = new CancellationToken()
const packager = new Packager(packagerOptions, cancellationToken)
const publishManager = new PublishManager(packager, {publish: checkOptions.publish || "never"})
const publishManager = new PublishManager(packager, {publish: "publish" in checkOptions ? checkOptions.publish : "never"})

const artifacts: Map<Platform, Array<ArtifactCreated>> = new Map()
packager.artifactCreated(event => {
Expand Down

0 comments on commit b72b9e8

Please sign in to comment.