diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2022-10-10 12:34:12 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2022-10-10 12:34:12 +0200 |
| commit | 27470f46a55c478abe994dfa86646fad5dc3847e (patch) | |
| tree | 51d75bf5b47aeed30dfa2078fe42fe580243903b /gui | |
| parent | f334c2a84faaed748aeb857085e0754e189e4b2f (diff) | |
| parent | ec7ea9fb689c6c3087ccbc4d37cbb786fff44895 (diff) | |
| download | mullvadvpn-27470f46a55c478abe994dfa86646fad5dc3847e.tar.xz mullvadvpn-27470f46a55c478abe994dfa86646fad5dc3847e.zip | |
Merge branch 'improve-rust-crate-versioning'
Diffstat (limited to 'gui')
| -rw-r--r-- | gui/package-lock.json | 4 | ||||
| -rw-r--r-- | gui/package.json | 2 | ||||
| -rw-r--r-- | gui/tasks/distribution.js | 27 |
3 files changed, 30 insertions, 3 deletions
diff --git a/gui/package-lock.json b/gui/package-lock.json index 09a98266a9..8a2b182aef 100644 --- a/gui/package-lock.json +++ b/gui/package-lock.json @@ -1,12 +1,12 @@ { "name": "mullvad-vpn", - "version": "2022.5.0-beta2", + "version": "0.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "mullvad-vpn", - "version": "2022.5.0-beta2", + "version": "0.0.0", "hasInstallScript": true, "license": "GPL-3.0", "dependencies": { diff --git a/gui/package.json b/gui/package.json index ec2ab566d8..36bc9c6013 100644 --- a/gui/package.json +++ b/gui/package.json @@ -1,6 +1,6 @@ { "name": "mullvad-vpn", - "version": "2022.5.0-beta2", + "version": "0.0.0", "productName": "Mullvad VPN", "private": true, "description": "Mullvad VPN client", diff --git a/gui/tasks/distribution.js b/gui/tasks/distribution.js index b778a57b8c..1a54c2a93a 100644 --- a/gui/tasks/distribution.js +++ b/gui/tasks/distribution.js @@ -5,6 +5,7 @@ const { Arch } = require('electron-builder'); const parseSemver = require('semver/functions/parse'); const { notarize } = require('electron-notarize'); const { version } = require('../package.json'); +const { execFileSync } = require('child_process'); const noCompression = process.argv.includes('--no-compression'); const noAppleNotarization = process.argv.includes('--no-apple-notarization'); @@ -38,6 +39,9 @@ const config = { extraMetadata: { name: 'mullvad-vpn', + // We have to stick to semver on Windows for now due to: + // https://github.com/electron-userland/electron-builder/issues/7173 + version: productVersion(process.platform === 'win32' ? ['semver'] : []) }, files: [ @@ -240,6 +244,22 @@ function packWin() { process.env.CPP_BUILD_MODE = release ? 'Release' : 'Debug'; return true; }, + afterAllArtifactBuild: (buildResult) => { + // All of this is a hack to work around the limitation in: + // https://github.com/electron-userland/electron-builder/issues/7173 + const productSemverVersion = productVersion(['semver']); + const productTargetVersion = productVersion([]); + + // Rename the artifacts so that they don't have the .0 (semver format) + for (const artifactPath of buildResult.artifactPaths) { + const artifactDir = path.dirname(artifactPath); + const artifactSemverFilename = path.basename(artifactPath); + const artifactDesiredFilename = artifactSemverFilename.replace(productSemverVersion, productTargetVersion); + const targetArtifactPath = path.join(artifactDir, artifactDesiredFilename); + console.log("Moving", artifactSemverFilename, "=>", artifactDesiredFilename); + fs.renameSync(artifactPath, targetArtifactPath); + } + }, }, }); } @@ -405,6 +425,13 @@ function getDebVersion() { return `${major}.${minor}`; } +// Returns the product version. The `args` argument is optional. Set it to `'semver'` +// to get the version in semver format. +function productVersion(extra_args) { + const args = ['run', '-q', '--bin', 'mullvad-version', ...extra_args]; + return execFileSync('cargo', args, { encoding: 'utf-8' }).trim(); +} + packWin.displayName = 'builder-win'; packMac.displayName = 'builder-mac'; packLinux.displayName = 'builder-linux'; |
