diff --git a/.vsts/common/set-dist-vars.yml b/.vsts/common/set-dist-vars.yml index dd1b26d4c6..3974648c07 100644 --- a/.vsts/common/set-dist-vars.yml +++ b/.vsts/common/set-dist-vars.yml @@ -1,7 +1,4 @@ steps: - powershell: $(Build.SourcesDirectory)/scripts/azpipelines/build-type.ps1 "$(Build.SourceBranch)" "$(Build.BuildNumber)" - displayName: Resolve build type - - - powershell: $(Build.SourcesDirectory)/scripts/azpipelines/update-build-name.ps1 - displayName: Resolve version + displayName: Resolve build info diff --git a/.vsts/win/distribution.yml b/.vsts/win/distribution.yml index 82fecad01e..b8a3e8ca12 100644 --- a/.vsts/win/distribution.yml +++ b/.vsts/win/distribution.yml @@ -3,6 +3,12 @@ steps: - template: ./credscan.yml - template: ./win-dependencies.yml + - powershell: | + $version = npm run -s ts scripts/package/get-version + Write-Host "Updating build number to $version" + Write-Host "##vso[build.updatebuildnumber]$version" + displayName: Update build version for packaging + - powershell: | . .vsts/win/exec.ps1 $ErrorActionPreference = "Stop" diff --git a/scripts/azpipelines/build-type.ps1 b/scripts/azpipelines/build-type.ps1 index a9b0d45cab..0e4c67e780 100644 --- a/scripts/azpipelines/build-type.ps1 +++ b/scripts/azpipelines/build-type.ps1 @@ -3,21 +3,21 @@ param ( $buildNumber ) # This compute the build type for VSTS build -$buildType="dev" +$buildType = "dev" Write-Host "Branch is $branch" If ($branch -like "refs/heads/master") { - $buildType="insider" + $buildType = "insider" } If ($branch -like "refs/heads/stable") { - $buildType="stable" + $buildType = "stable" } # Change to curent branch for testing If ($branch -like "refs/heads/feature/signing-vsts") { - $buildType="testing" + $buildType = "testing" } Write-Host "Build type is $buildType" @@ -26,6 +26,6 @@ Write-Host "##vso[task.setvariable variable=BUILD_TYPE]$buildType" # Hyphens in the version causes RPM packaging to fail # See https://azurebatch.visualstudio.com/BatchExplorer/_workitems/edit/379 -$newBuildNumber=$buildNumber -replace '-', '_' +$newBuildNumber = $buildNumber -replace '-', '_' Write-Host "Setting build number to $newBuildNumber" Write-Host "##vso[build.updatebuildnumber]$newBuildNumber" diff --git a/scripts/azpipelines/update-build-name.ps1 b/scripts/azpipelines/update-build-name.ps1 deleted file mode 100644 index bc40d40121..0000000000 --- a/scripts/azpipelines/update-build-name.ps1 +++ /dev/null @@ -1,4 +0,0 @@ -$version = $(npm pkg get version) -replace '"', "" - -Write-Host "Updating build number to $version" -Write-Host "##vso[build.updatebuildnumber]$version" diff --git a/scripts/package/get-version.ts b/scripts/package/get-version.ts new file mode 100644 index 0000000000..0a387db215 --- /dev/null +++ b/scripts/package/get-version.ts @@ -0,0 +1,3 @@ +import { version } from "./package-utils"; +// eslint-disable no-console +console.log(version);