Skip to content

Commit

Permalink
Worked with Alex to update pipeline to give us special versions per P…
Browse files Browse the repository at this point in the history
…R for a future Azure Feed
  • Loading branch information
michael-hawker committed Oct 19, 2020
1 parent d21e7af commit 098deec
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
14 changes: 12 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pool:

variables:
BuildConfiguration: Release
isPR: $[eq(variables['build.reason'], 'PullRequest')]

jobs:
- job: ToolkitBuild
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions version.json
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 098deec

Please sign in to comment.