Skip to content

Commit 3d39fa6

Browse files
committed
feat(nsis): artifact file name pattern
Close #1221, #1219
1 parent 4546b1c commit 3d39fa6

36 files changed

+224
-137
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ A complete solution to package and build a ready for distribution Electron app f
1313
* [Linux](https://github.com/electron-userland/electron-builder/wiki/Options#LinuxBuildOptions-target): [AppImage](http://appimage.org), [snap](http://snapcraft.io), debian package (`deb`), `rpm`, `freebsd`, `pacman`, `p5p`, `apk`.
1414
* [Windows](https://github.com/electron-userland/electron-builder/wiki/Options#WinBuildOptions-target): NSIS, AppX (Windows Store), Squirrel.Windows.
1515
* [Two package.json structure](https://github.com/electron-userland/electron-builder/wiki/Two-package.json-Structure) is supported, but you are not forced to use it even if you have native production dependencies.
16-
* [Publishing artifacts](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts) to GitHub Releases and Bintray.
16+
* [Publishing artifacts](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts) to GitHub Releases, Amazon S3 and Bintray.
1717
* Pack in a distributable format [already packaged app](#pack-only-in-a-distributable-format).
1818

1919
| Question | Answer |

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- sudo apt-get install git-lfs=1.3.0
1515
- ssh git@github.com git-lfs-authenticate $CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME.git download
1616
- git lfs pull
17-
- docker run --rm --env-file ./test/docker-env.list -v ${PWD}:/project -v ~/.electron:/root/.electron -v ~/.cache/electron-builder:/root/.cache/electron-builder electronuserland/electron-builder:$([ "$CIRCLE_NODE_INDEX" == "2" ] && echo "6" || echo "wine") /bin/bash -c "node ./test/vendor/yarn.js && node ./test/vendor/yarn.js test"
17+
- docker run --rm --env-file ./test/docker-env.list -v ${PWD}:/project -v ~/.electron:/root/.electron -v ~/.cache/electron-builder:/root/.cache/electron-builder electronuserland/electron-builder:wine) /bin/bash -c "node ./test/vendor/yarn.js && node ./test/vendor/yarn.js test"
1818

1919
test:
2020
override:

docs/Auto Update.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Emitted when there is no available update.
8686
* `total`
8787
* `transferred`
8888
89-
Emitted on progress. Only supported over Windows build, since `Squirrel.Mac` does not provide this data.
89+
Emitted on progress. Only supported over Windows build, since `Squirrel.Mac` [does not provide](https://github.com/electron-userland/electron-builder/issues/1167) this data.
9090
9191
#### Event: `update-downloaded`
9292

docs/Options.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ See [NSIS target notes](https://github.com/electron-userland/electron-builder/wi
178178
| language | <a name="NsisOptions-language"></a>* [LCID Dec](https://msdn.microsoft.com/en-au/goglobal/bb964664.aspx), defaults to `1033`(`English - United States`).
179179
| warningsAsErrors | <a name="NsisOptions-warningsAsErrors"></a>Defaults to `true`. If `warningsAsErrors` is `true` (default): NSIS will treat warnings as errors. If `warningsAsErrors` is `false`: NSIS will allow warnings.
180180
| menuCategory | <a name="NsisOptions-menuCategory"></a>Whether to create submenu for start menu shortcut and program files directory. Defaults to `false`. If `true`, company name will be used. Or string value.
181+
| artifactName | <a name="NsisOptions-artifactName"></a><p>The artifact file name pattern. Defaults to <code>${productName} Setup ${version}.${ext}</code>. <code>${name}</code>, <code>${productName}</code>, <code>${version}</code>, <code>${ext}</code>, <code>${arch}</code>, <code>${os}</code> (expanded to <code>mac</code>, <code>linux</code> or <code>win</code> according to current platform) macro are supported.</p> <p>If no <code>arch</code>, macro will be removed from your pattern with leading space, <code>-</code> or <code>_</code> (so, you don’t need to worry and can reuse pattern).</p>
181182

182183
<a name="Protocol"></a>
183184
### `protocols` URL Protocol Schemes

docs/Publishing Artifacts.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ Travis and AppVeyor support publishing artifacts. But it requires additional con
22

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

5-
Currently, [GitHub Releases](https://help.github.com/articles/about-releases/), [Bintray](https://bintray.com) and [S3](https://aws.amazon.com/s3/) are supported.
5+
Currently, [GitHub Releases](https://help.github.com/articles/about-releases/), [Amazon S3](https://aws.amazon.com/s3/) and [Bintray](https://bintray.com) are supported.
6+
7+
To use Amazon S3 please install `electron-publisher-s3` dependency.
68

79
## CLI Flags
810
```
@@ -72,7 +74,7 @@ But please consider using automatic rules instead of explicitly specifying `publ
7274
<a name="PublishConfiguration"></a>
7375
### `publish`
7476

75-
Can be specified in the [build](https://github.com/electron-userland/electron-builder/wiki/Options#build) or any platform- or target- specific options.
77+
Can be specified in the [config](https://github.com/electron-userland/electron-builder/wiki/Options#configuration-options) or any platform- or target- specific options.
7678

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"7zip-bin": "^2.0.4",
2626
"archiver": "^1.3.0",
2727
"asar-electron-builder": "^0.13.5",
28-
"aws-sdk": "^2.9.0",
28+
"aws-sdk": "^2.10.0",
2929
"bluebird-lst-c": "^1.0.6",
3030
"chalk": "^1.1.3",
3131
"chromium-pickle-js": "^0.2.0",

packages/electron-builder-http/src/publishOptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export type Publish = string | Array<string> | PublishConfiguration | GithubOpti
55
/*
66
### `publish`
77
8-
Can be specified in the [build](https://github.com/electron-userland/electron-builder/wiki/Options#build) or any platform- or target- specific options.
8+
Can be specified in the [config](https://github.com/electron-userland/electron-builder/wiki/Options#configuration-options) or any platform- or target- specific options.
99
1010
If `GH_TOKEN` is set — defaults to `[{provider: "github"}]`.
1111
If `BT_TOKEN` is set and `GH_TOKEN` is not set — defaults to `[{provider: "bintray"}]`.
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
# electron-publisher-s3
1+
# electron-builder-publisher
22

33
Part of [electron-builder](https://github.com/electron-userland/electron-builder).
44

5-
See the [Publishing Artifacts.](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts) section of the [Wiki](https://github.com/electron-userland/electron-builder/wiki) for more information.
5+
See the [Publishing Artifacts](https://github.com/electron-userland/electron-builder/wiki/Publishing-Artifacts) section of the [Wiki](https://github.com/electron-userland/electron-builder/wiki) for more information.
6+
7+
Can be used standalone.

packages/electron-builder-publisher/src/gitHubPublisher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class GitHubPublisher extends HttpPublisher {
4242
}
4343

4444
constructor(context: PublishContext, private readonly info: GithubOptions, private readonly version: string, private readonly options: PublishOptions = {}) {
45-
super(context)
45+
super(context, true)
4646

4747
let token = info.token
4848
if (isEmptyOrSpaces(token)) {

packages/electron-builder-publisher/src/publisher.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export abstract class Publisher {
3333

3434
abstract get providerName(): string
3535

36-
abstract upload(file: string, artifactName?: string): Promise<any>
36+
abstract upload(file: string, safeArtifactName?: string): Promise<any>
3737

3838
protected createProgressBar(fileName: string, fileStat: Stats): ProgressBar | null {
3939
if (this.context.progress == null) {
@@ -63,12 +63,12 @@ export abstract class Publisher {
6363
}
6464

6565
export abstract class HttpPublisher extends Publisher {
66-
constructor(protected readonly context: PublishContext) {
66+
constructor(protected readonly context: PublishContext, private readonly useSafeArtifactName = false) {
6767
super(context)
6868
}
6969

70-
async upload(file: string, artifactName?: string): Promise<any> {
71-
const fileName = artifactName || basename(file)
70+
async upload(file: string, safeArtifactName?: string): Promise<any> {
71+
const fileName = (this.useSafeArtifactName ? safeArtifactName : null) || basename(file)
7272
const fileStat = await stat(file)
7373

7474
const progressBar = this.createProgressBar(fileName, fileStat)

0 commit comments

Comments
 (0)