Skip to content

Commit 23f0b37

Browse files
committed
feat: ${buildVersion} macro in artifactName config
Close #1527
1 parent 78d9b33 commit 23f0b37

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

docs/Options.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ You can use macros in the file patterns, artifact file name patterns and publish
5555
* `${productName}` — [Sanitized](https://www.npmjs.com/package/sanitize-filename) product name.
5656
* `${version}`
5757
* `${env.ENV_NAME}` — any environment variable.
58+
* Any property of [AppInfo](https://github.com/electron-userland/electron-builder/wiki/electron-builder#AppInfo) (e.g. `buildVersion`, `buildNumber`).
5859

5960
## Source and Destination Directories
6061
You may also specify custom source and destination directories by using JSON objects instead of simple glob patterns.

packages/electron-builder/src/platformPackager.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -357,12 +357,6 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
357357
const appInfo = this.appInfo
358358
return pattern.replace(/\$\{([_a-zA-Z./*]+)\}/g, (match, p1): string => {
359359
switch (p1) {
360-
case "name":
361-
return appInfo.name
362-
363-
case "version":
364-
return appInfo.version
365-
366360
case "productName":
367361
return appInfo.productFilename
368362

@@ -377,6 +371,10 @@ export abstract class PlatformPackager<DC extends PlatformSpecificBuildOptions>
377371
return this.platform.buildConfigurationKey
378372

379373
default:
374+
if (p1 in appInfo) {
375+
return (<any>appInfo)[p1]
376+
}
377+
380378
if (p1.startsWith("env.")) {
381379
const envName = p1.substring("env.".length)
382380
const envValue = process.env[envName]

0 commit comments

Comments
 (0)