From 51d033897eb5663ea8bab53704406d9fd82af98f Mon Sep 17 00:00:00 2001 From: Steve MacLean Date: Mon, 11 Feb 2019 16:39:44 -0500 Subject: [PATCH] Publish version to dotnet/versions --- azure-pipelines.yml | 5 +--- eng/build-job.yml | 6 ++++ eng/finalize-publish.yml | 78 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 4 deletions(-) create mode 100644 eng/finalize-publish.yml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8fb69c9..259b362 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -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 diff --git a/eng/build-job.yml b/eng/build-job.yml index f5d7b22..e2f2428 100644 --- a/eng/build-job.yml +++ b/eng/build-job.yml @@ -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 index 0000000..b5fc307 --- /dev/null +++ b/eng/finalize-publish.yml @@ -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() -- 2.7.4