Add GetReleaseVersion step to set ReleaseVersion variable

This commit is contained in:
David Wilson
2018-07-26 07:31:34 -07:00
parent 7d3ab82fec
commit c293c43997
2 changed files with 22 additions and 8 deletions

View File

@@ -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}`)

View File

@@ -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