Skip to content

Commit

Permalink
fix: more clear handling of onTagOrDraft
Browse files Browse the repository at this point in the history
  • Loading branch information
develar committed May 30, 2017
1 parent e63e8fa commit 817340a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 30 deletions.
45 changes: 23 additions & 22 deletions docs/api/electron-builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,10 @@ Developer API only. See [[Options]] for user documentation.

* [electron-builder/out/codeSign](#module_electron-builder/out/codeSign)
* [`.CodeSigningInfo`](#CodeSigningInfo)
* [`.CreateKeychainOptions`](#CreateKeychainOptions)
* [`.findIdentityRawResult`](#module_electron-builder/out/codeSign.findIdentityRawResult) : <code>Promise&lt;Array&lt;string&gt;&gt;</code> \| <code>null</code>
* [`.createKeychain(tmpDir, cscLink, cscKeyPassword, cscILink, cscIKeyPassword)`](#module_electron-builder/out/codeSign.createKeychain) ⇒ <code>Promise&lt;[CodeSigningInfo](#CodeSigningInfo)&gt;</code>
* [`.downloadCertificate(urlOrBase64, tmpDir)`](#module_electron-builder/out/codeSign.downloadCertificate) ⇒ <code>Promise&lt;string&gt;</code>
* [`.createKeychain(undefined)`](#module_electron-builder/out/codeSign.createKeychain) ⇒ <code>Promise&lt;[CodeSigningInfo](#CodeSigningInfo)&gt;</code>
* [`.downloadCertificate(urlOrBase64, tmpDir, currentDir)`](#module_electron-builder/out/codeSign.downloadCertificate) ⇒ <code>Promise&lt;string&gt;</code>
* [`.findIdentity(certType, qualifier, keychain)`](#module_electron-builder/out/codeSign.findIdentity) ⇒ <code>Promise&lt; \| string&gt;</code>
* [`.sign(path, name, keychain)`](#module_electron-builder/out/codeSign.sign) ⇒ <code>Promise&lt;any&gt;</code>

Expand All @@ -368,32 +369,44 @@ Developer API only. See [[Options]] for user documentation.
| --- | --- |
| keychainName| <code>string</code> \| <code>null</code> |

<a name="CreateKeychainOptions"></a>

### `CreateKeychainOptions`
**Kind**: interface of [<code>electron-builder/out/codeSign</code>](#module_electron-builder/out/codeSign)
**Properties**

| Name | Type |
| --- | --- |
| **tmpDir**| <code>[TmpDir](electron-builder-util#TmpDir)</code> |
| **cscLink**| <code>string</code> |
| **cscKeyPassword**| <code>string</code> |
| cscILink| <code>string</code> \| <code>null</code> |
| cscIKeyPassword| <code>string</code> \| <code>null</code> |
| **currentDir**| <code>string</code> |

<a name="module_electron-builder/out/codeSign.findIdentityRawResult"></a>

### `electron-builder/out/codeSign.findIdentityRawResult` : <code>Promise&lt;Array&lt;string&gt;&gt;</code> \| <code>null</code>
**Kind**: property of [<code>electron-builder/out/codeSign</code>](#module_electron-builder/out/codeSign)
<a name="module_electron-builder/out/codeSign.createKeychain"></a>

### `electron-builder/out/codeSign.createKeychain(tmpDir, cscLink, cscKeyPassword, cscILink, cscIKeyPassword)` ⇒ <code>Promise&lt;[CodeSigningInfo](#CodeSigningInfo)&gt;</code>
### `electron-builder/out/codeSign.createKeychain(undefined)` ⇒ <code>Promise&lt;[CodeSigningInfo](#CodeSigningInfo)&gt;</code>
**Kind**: method of [<code>electron-builder/out/codeSign</code>](#module_electron-builder/out/codeSign)

| Param | Type |
| --- | --- |
| tmpDir | <code>[TmpDir](electron-builder-util#TmpDir)</code> |
| cscLink | <code>string</code> |
| cscKeyPassword | <code>string</code> |
| cscILink | <code>string</code> \| <code>null</code> |
| cscIKeyPassword | <code>string</code> \| <code>null</code> |
| undefined | <code>[CreateKeychainOptions](#CreateKeychainOptions)</code> |

<a name="module_electron-builder/out/codeSign.downloadCertificate"></a>

### `electron-builder/out/codeSign.downloadCertificate(urlOrBase64, tmpDir)` ⇒ <code>Promise&lt;string&gt;</code>
### `electron-builder/out/codeSign.downloadCertificate(urlOrBase64, tmpDir, currentDir)` ⇒ <code>Promise&lt;string&gt;</code>
**Kind**: method of [<code>electron-builder/out/codeSign</code>](#module_electron-builder/out/codeSign)

| Param | Type |
| --- | --- |
| urlOrBase64 | <code>string</code> |
| tmpDir | <code>[TmpDir](electron-builder-util#TmpDir)</code> |
| currentDir | <code>string</code> |

<a name="module_electron-builder/out/codeSign.findIdentity"></a>

Expand Down Expand Up @@ -1658,7 +1671,6 @@ Developer API only. See [[Options]] for user documentation.
* [.PublishManager](#PublishManager) ⇐ <code>[PublishContext](electron-publish#PublishContext)</code>
* [`.awaitTasks()`](#module_electron-builder/out/publish/PublishManager.PublishManager+awaitTasks) ⇒ <code>Promise&lt;void&gt;</code>
* [`.cancelTasks()`](#module_electron-builder/out/publish/PublishManager.PublishManager+cancelTasks)
* [`.getOrCreatePublisher(publishConfig, buildInfo)`](#module_electron-builder/out/publish/PublishManager.PublishManager+getOrCreatePublisher) ⇒ <code>null</code> \| <code>[Publisher](electron-publish#Publisher)</code>
* [`.computeDownloadUrl(publishConfig, fileName, packager)`](#module_electron-builder/out/publish/PublishManager.computeDownloadUrl) ⇒ <code>string</code>
* [`.createPublisher(context, version, publishConfig, options)`](#module_electron-builder/out/publish/PublishManager.createPublisher) ⇒ <code>null</code> \| <code>[Publisher](electron-publish#Publisher)</code>
* [`.getPublishConfigs(packager, targetSpecificOptions, arch)`](#module_electron-builder/out/publish/PublishManager.getPublishConfigs) ⇒ <code>Promise&lt; \| Array&gt;</code>
Expand All @@ -1680,7 +1692,6 @@ Developer API only. See [[Options]] for user documentation.
* [.PublishManager](#PublishManager) ⇐ <code>[PublishContext](electron-publish#PublishContext)</code>
* [`.awaitTasks()`](#module_electron-builder/out/publish/PublishManager.PublishManager+awaitTasks) ⇒ <code>Promise&lt;void&gt;</code>
* [`.cancelTasks()`](#module_electron-builder/out/publish/PublishManager.PublishManager+cancelTasks)
* [`.getOrCreatePublisher(publishConfig, buildInfo)`](#module_electron-builder/out/publish/PublishManager.PublishManager+getOrCreatePublisher) ⇒ <code>null</code> \| <code>[Publisher](electron-publish#Publisher)</code>

<a name="module_electron-builder/out/publish/PublishManager.PublishManager+awaitTasks"></a>

Expand All @@ -1690,16 +1701,6 @@ Developer API only. See [[Options]] for user documentation.

#### `publishManager.cancelTasks()`
**Kind**: instance method of [<code>PublishManager</code>](#PublishManager)
<a name="module_electron-builder/out/publish/PublishManager.PublishManager+getOrCreatePublisher"></a>

#### `publishManager.getOrCreatePublisher(publishConfig, buildInfo)` ⇒ <code>null</code> \| <code>[Publisher](electron-publish#Publisher)</code>
**Kind**: instance method of [<code>PublishManager</code>](#PublishManager)

| Param | Type |
| --- | --- |
| publishConfig | <code>[PublishConfiguration](Publishing-Artifacts#PublishConfiguration)</code> |
| buildInfo | <code>[BuildInfo](Options#BuildInfo)</code> |

<a name="module_electron-builder/out/publish/PublishManager.computeDownloadUrl"></a>

### `electron-builder/out/publish/PublishManager.computeDownloadUrl(publishConfig, fileName, packager)` ⇒ <code>string</code>
Expand Down Expand Up @@ -2607,7 +2608,7 @@ Developer API only. See [[Options]] for user documentation.
else {
const cscLink = process.env.WIN_CSC_LINK || this.packagerOptions.cscLink
if (cscLink != null) {
return downloadCertificate(cscLink, this.info.tempDirManager)
return downloadCertificate(cscLink, this.info.tempDirManager, this.projectDir)
.then(path =&gt; {
return {
file: path,
Expand Down
17 changes: 9 additions & 8 deletions packages/electron-builder/src/publish/PublishManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ export class PublishManager implements PublishContext {
constructor(packager: Packager, private readonly publishOptions: PublishOptions, readonly cancellationToken: CancellationToken) {
const forcePublishForPr = process.env.PUBLISH_FOR_PULL_REQUEST === "true"
if (!isPullRequest() || forcePublishForPr) {
if (forcePublishForPr) {
warn(publishForPrWarning)
}

if (publishOptions.publish === undefined) {
if (process.env.npm_lifecycle_event === "release") {
publishOptions.publish = "always"
Expand All @@ -52,15 +48,20 @@ export class PublishManager implements PublishContext {
log(`Tag ${tag} is defined, so artifacts will be published`)
publishOptions.publish = "onTag"
}
else if (isCi) {
else if (isCi && !isEmptyOrSpaces(process.env.GH_TOKEN)) {
log("CI detected, so artifacts will be published if draft release exists")
publishOptions.publish = "onTagOrDraft"
}
}
}

if (publishOptions.publish != null && publishOptions.publish !== "never") {
this.isPublish = publishOptions.publish !== "onTag" || getCiTag() != null
const publishPolicy = publishOptions.publish
if (publishPolicy != null && (publishPolicy === "always" || (publishPolicy.startsWith("onTag") && getCiTag() != null))) {
if (forcePublishForPr) {
warn(publishForPrWarning)
}

this.isPublish = true
}
}
else if (publishOptions.publish !== "never") {
Expand Down Expand Up @@ -153,7 +154,7 @@ export class PublishManager implements PublishContext {
.catch(it => this.errors.push(it)))
}

getOrCreatePublisher(publishConfig: PublishConfiguration, buildInfo: BuildInfo): Publisher | null {
private getOrCreatePublisher(publishConfig: PublishConfiguration, buildInfo: BuildInfo): Publisher | null {
let publisher = this.nameToPublisher.get(publishConfig.provider)
if (publisher == null) {
publisher = createPublisher(this, buildInfo.metadata.version!, publishConfig, this.publishOptions)
Expand Down

0 comments on commit 817340a

Please sign in to comment.