ADD win_ext to URL template variables

This commit is contained in:
David Recuenco
2019-03-25 15:17:11 +01:00
parent 9071f9b229
commit 6eaf5fc9af
2 changed files with 13 additions and 8 deletions

View File

@@ -84,6 +84,7 @@ Following variables are available to customize the URL:
* `{{version}}`: Version number read from `package.json` file. When you publish your package to NPM, it will use this version number. Ex: 0.0.1
* `{{platform}}`: `$GOOS` value for the platform
* `{{arch}}`: `$GOARCH` value for the architecture
* `{{ win_ext }}`: optional `.exe` extension for windows assets.
If you use `goreleaser` to publish your modules, it will automatically set the right architecture & platform in your URL.

View File

@@ -129,7 +129,11 @@ function parsePackageJson() {
// Binary name on Windows has .exe suffix
if (process.platform === "win32") {
binName += ".exe"
binName += ".exe";
url = url.replace(/{{win_ext}}/g, '.exe');
} else {
url = url.replace(/{{win_ext}}/g, '');
}
// Interpolate variables in URL, if necessary
@@ -143,7 +147,7 @@ function parsePackageJson() {
binPath: binPath,
url: url,
version: version
}
};
}
/**