Publish version to dotnet/versions
authorSteve MacLean <Steve.MacLean@Microsoft.com>
Mon, 11 Feb 2019 21:39:44 +0000 (16:39 -0500)
committerSteve MacLean <stmaclea@microsoft.com>
Fri, 15 Feb 2019 21:28:03 +0000 (16:28 -0500)
azure-pipelines.yml
eng/build-job.yml
eng/finalize-publish.yml [new file with mode: 0644]

index 8fb69c9..259b362 100644 (file)
@@ -291,11 +291,8 @@ jobs:
 # official builds if we add more platform/arch combinations.
 
 - ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
-  - template: /eng/common/templates/job/publish-build-assets.yml
+  - template: /eng/finalize-publish.yml
     parameters:
-      configuration: Release
-      pool:
-        name: dotnet-internal-temp
       dependsOn:
       - build_Linux_arm_release
       - build_Linux_arm64_release
index f5d7b22..e2f2428 100644 (file)
@@ -171,6 +171,12 @@ jobs:
           env:
             # TODO: remove NUGET_PACKAGES once https://github.com/dotnet/arcade/issues/1578 is fixed
             NUGET_PACKAGES: $(Build.SourcesDirectory)\.packages 
+      # Save nuget packages in pipeline for update dotnet/versions
+      - task: PublishPipelineArtifact@0
+        displayName: Save packages as pipeline artifact
+        inputs:
+          artifactName: ${{ format('build_{0}_{1}_{2}_nuget', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }}
+          targetPath: $(Build.SourcesDirectory)/bin/Product/$(osGroup).$(archType).$(buildConfigUpper)/.nuget/pkg
 
 
     # Kill tasks that hold onto files on Windows. Otherwise git clean
diff --git a/eng/finalize-publish.yml b/eng/finalize-publish.yml
new file mode 100644 (file)
index 0000000..b5fc307
--- /dev/null
@@ -0,0 +1,78 @@
+parameters:
+  # Optional: dependencies of the job
+  dependsOn: ''
+
+  artifactsDir: $(Build.StagingDirectory)/artifacts
+
+  gitHubUser: dotnet-build-bot
+  gitHubEmail: dotnet-build-bot@microsoft.com
+  gitHubAuthToken: $(AccessToken-dotnet-build-bot-public-repo)
+
+  versionsRepoOwner: dotnet
+  versionsRepo: versions
+
+jobs:
+  - template: /eng/common/templates/job/publish-build-assets.yml
+    parameters:
+      configuration: Release
+      pool:
+        name: dotnet-internal-temp
+      dependsOn: ${{ parameters.dependsOn }}
+  # Update dotnet/versions
+  - job: Finalize_Publish_Versions
+    displayName: Finalize_Publish_Versions
+    dependsOn:
+    - Asset_Registry_Publish
+    pool:
+      name: Hosted VS2017
+    variables:
+      - group: DotNet-Versions-Publish
+    steps:
+    # Download nuget packages
+    # Use parameters.dependsOn to determine the set of nuget packages we are publishing
+    - ${{ each build_id in parameters.dependsOn }}:
+      - task: DownloadPipelineArtifact@0
+        displayName: Download ${{ build_id }} nuget packages
+        inputs:
+          artifactName: ${{ build_id }}_nuget
+          targetPath: ${{ parameters.artifactsDir }}/nuget
+
+    - powershell: |
+        $prefix = "refs/heads/"
+        $branch = "$(Build.SourceBranch)"
+        $branchName = $branch
+        if ($branchName.StartsWith($prefix))
+        {
+          $branchName = $branchName.Substring($prefix.Length)
+        }
+        Write-Host "For Build.SourceBranch $branch, FullBranchName is $branchName"
+        Write-Host "##vso[task.setvariable variable=FullBranchName;]$branchName"
+        ls -R ${{ parameters.artifactsDir }}/nuget/*.nupkg
+        $(Build.SourcesDirectory)/UpdatePublishedVersions.ps1 `
+        -gitHubUser ${{ parameters.gitHubUser }} `
+        -gitHubEmail ${{ parameters.gitHubEmail }} `
+        -gitHubAuthToken ${{ parameters.gitHubAuthToken }} `
+        -versionsRepoOwner ${{ parameters.versionsRepoOwner }} `
+        -versionsRepo ${{ parameters.versionsRepo }} `
+        -versionsRepoPath build-info/dotnet/coreclr/$branchName `
+        -nupkgPath ${{ parameters.artifactsDir }}/nuget/*.nupkg
+
+      displayName: Run UpdatePublishedVersions.ps1
+
+    - task: CopyFiles@2
+      displayName: Copy Files to $(Build.StagingDirectory)\BuildLogs
+      inputs:
+        SourceFolder: '$(Build.SourcesDirectory)'
+        Contents: |
+          *.log
+          *.binlog
+        TargetFolder: '$(Build.StagingDirectory)\BuildLogs'
+      continueOnError: true
+      condition: succeededOrFailed()
+
+    - task: PublishBuildArtifacts@1
+      displayName: Publish Artifact BuildLogs
+      inputs:
+        PathtoPublish: '$(Build.StagingDirectory)\BuildLogs'
+        ArtifactName: Finalize_Publish_Versions
+      condition: succeededOrFailed()