diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 75d381267ec..d0a148a65fd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,6 +11,7 @@ pool: variables: BuildConfiguration: Release + isPR: $[eq(variables['build.reason'], 'PullRequest')] jobs: - job: ToolkitBuild @@ -36,8 +37,17 @@ jobs: arguments: install --tool-path . nbgv displayName: Install NBGV tool + # if we're a PR, get the version from version.json, replace the 'build' string with the string 'PullRequest####', and set it back again + - powershell: | + $jsonFile = (Get-Content .\version.json) -replace '^\s*//*.*' | ConvertFrom-Json <# Get Version.Json, remove comments, and convert to JSON obj #> + $jsonFile.Version = $jsonFile.Version -replace "build", ("PullRequest{0}" -f "$(System.PullRequest.PullRequestNumber)") <# Update Build With PullRequest and ID #> + ConvertTo-Json @jsonFile | Set-Content .\version.json <# Save back to version.json so next step can update {height} #> + condition: eq(variables.isPR, true) + displayName: Update Version.json for PRs + + # get build height - script: nbgv cloud - displayName: Set Version + displayName: Set Version Height #- powershell: .\build\Install-WindowsSdkISO.ps1 19041 # displayName: Insider SDK @@ -81,7 +91,7 @@ jobs: SignClientUser: $(SignClientUser) SignClientSecret: $(SignClientSecret) ArtifactDirectory: bin\nupkg - condition: and(succeeded(), not(eq(variables['build.reason'], 'PullRequest')), not(eq(variables['SignClientSecret'], '')), not(eq(variables['SignClientUser'], ''))) + condition: and(succeeded(), not(variables.isPR), not(eq(variables.SignClientSecret, '')), not(eq(variables.SignClientUser, ''))) - task: PublishBuildArtifacts@1 displayName: Publish Package Artifacts diff --git a/version.json b/version.json index a9ad31dbfc4..907e7082e37 100644 --- a/version.json +++ b/version.json @@ -1,9 +1,12 @@ { "version": "7.0.0-build.{height}", "publicReleaseRefSpec": [ - "^refs/heads/master$", // we release out of master - "^refs/heads/dev$", // we release out of dev - "^refs/heads/rel/\\d+\\.\\d+\\.\\d+" // we also release branches starting with rel/N.N.N + // we release out of master + "^refs/heads/master$", + // we release out of dev + "^refs/heads/dev$", + // we also release branches starting with rel/N.N.N + "^refs/heads/rel/\\d+\\.\\d+\\.\\d+" ], "nugetPackageVersion":{ "semVer": 2