From c293c4399704f373d306f7e66c879a6cfa05bdc6 Mon Sep 17 00:00:00 2001 From: David Wilson Date: Thu, 26 Jul 2018 07:31:34 -0700 Subject: [PATCH] Add GetReleaseVersion step to set ReleaseVersion variable --- script/vsts/get-version.js | 11 +++++++++++ script/vsts/stable-beta-release.yml | 19 +++++++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) create mode 100644 script/vsts/get-version.js diff --git a/script/vsts/get-version.js b/script/vsts/get-version.js new file mode 100644 index 000000000..04f980d9b --- /dev/null +++ b/script/vsts/get-version.js @@ -0,0 +1,11 @@ +const path = require('path') + +const repositoryRootPath = path.resolve(__dirname, '..', '..') +const appMetadata = require(path.join(repositoryRootPath, 'package.json')) +const releaseVersion = appMetadata.version + +// Set our ReleaseVersion build variable and update VSTS' build number to +// include the version. Writing these strings to stdout causes VSTS to set +// the associated variables. +console.log(`##vso[task.setvariable variable=ReleaseVersion;isOutput=true]${releaseVersion}`) +console.log(`##vso[build.updatebuildnumber]${releaseVersion}+${process.env.BUILD_BUILDNUMBER}`) diff --git a/script/vsts/stable-beta-release.yml b/script/vsts/stable-beta-release.yml index 390011856..f9c6d3f6f 100644 --- a/script/vsts/stable-beta-release.yml +++ b/script/vsts/stable-beta-release.yml @@ -3,15 +3,18 @@ trigger: phases: +- phase: GetReleaseVersion + steps: + # This has to be done separately because VSTS inexplicably + # exits the script block after `npm install` completes. + - script: | + cd script\vsts + npm install + displayName: npm install + - script: node script\vsts\get-version.js + name: Version + # Import OS-specific build definitions - template: windows.yml - template: macos.yml - template: linux.yml - -- phase: Release - queue: Hosted # Need this for Python 2.7 - - dependsOn: - - Windows - - Linux - - macOS