diff options
| author | Oskar Nyberg <oskar@mullvad.net> | 2020-11-13 19:51:53 +0100 |
|---|---|---|
| committer | Oskar Nyberg <oskar@mullvad.net> | 2020-11-13 19:51:53 +0100 |
| commit | a3ef4a5afc7005444b5e615946486226f83c9dc9 (patch) | |
| tree | 052d4a63e88cacdeab1ff036d4a4a5db6038d716 /gui/tasks | |
| parent | 7f00f3b01c2f8362393ad7d09e78cbc915765469 (diff) | |
| parent | e727ac9731cc9477c9113ab872148c3f220b466f (diff) | |
| download | mullvadvpn-a3ef4a5afc7005444b5e615946486226f83c9dc9.tar.xz mullvadvpn-a3ef4a5afc7005444b5e615946486226f83c9dc9.zip | |
Merge branch 'fix-deb-version-field'
Diffstat (limited to 'gui/tasks')
| -rw-r--r-- | gui/tasks/distribution.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gui/tasks/distribution.js b/gui/tasks/distribution.js index 99c812c615..56fe2d4318 100644 --- a/gui/tasks/distribution.js +++ b/gui/tasks/distribution.js @@ -2,8 +2,10 @@ const path = require('path'); const fs = require('fs'); const builder = require('electron-builder'); const rimraf = require('rimraf'); +const parseSemver = require('semver/functions/parse'); const util = require('util'); const { notarize } = require('electron-notarize'); +const { version } = require('../package.json'); const renameAsync = util.promisify(fs.rename); const unlinkAsync = util.promisify(fs.unlink); @@ -117,6 +119,8 @@ const config = { deb: { fpm: [ + '--version', + getDebVersion(), '--before-install', distAssets('linux/before-install.sh'), '--before-remove', @@ -247,6 +251,18 @@ function root(relativePath) { return path.join(path.resolve(__dirname, '../../'), relativePath); } +// Replace '-' between components with a tilde to make the version comparison understand that +// YYYY.NN > YYYY.NN-betaN > YYYY.NN-betaN-dev-HHHHHH. +function getDebVersion() { + const { major, minor, prerelease } = parseSemver(version); + const versionParts = [`${major}.${minor}`]; + if (prerelease[0]) { + // Replace first '-' with a '~' since the first one is the one between 'betaN' and 'dev-hash'. + versionParts.push(prerelease[0].replace('-', '~')); + } + return versionParts.join('~'); +} + packWin.displayName = 'builder-win'; packMac.displayName = 'builder-mac'; packLinux.displayName = 'builder-linux'; |
