Merge pull request #8092 from sfoslund/BranchInfo

Dynamically acquire branch info
This commit is contained in:
Marc Paine 2020-08-05 14:15:24 -07:00 committed by GitHub
commit bbbf208d03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 7 deletions

View file

@ -301,4 +301,5 @@ stages:
/p:DotNetPublishSdkAssetsBlobFeedKey=$(dotnetcli-storage-key)
/p:DotnetPublishChecksumsBlobFeedUrl=https://dotnetclichecksums.blob.core.windows.net/dotnet/index.json
/p:DotNetPublishChecksumsBlobFeedKey=$(dotnetclichecksums-storage-key)
/p:SourceBranch=$(BUILD.SOURCEBRANCH)
displayName: Copy to latest

View file

@ -3,12 +3,12 @@
<TargetFramework>$(CoreSdkTargetFramework)</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<CopyBuildOutputToPublishDirectory>false</CopyBuildOutputToPublishDirectory>
<Channel>$(SourceBranch.Replace('refs/heads/', ''))</Channel>
</PropertyGroup>
<Import Project="targets\BranchInfo.props" />
<Import Project="..\redist\targets\BuildCoreSdkTasks.targets" />
<Import Project="..\redist\targets\GetRuntimeInformation.targets" />
<Import Project="..\redist\targets\Versions.targets" />
<Import Project="targets\FinishBuild.targets" />
</Project>
</Project>

View file

@ -1,5 +0,0 @@
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Channel>master</Channel>
</PropertyGroup>
</Project>

View file

@ -64,6 +64,11 @@ namespace Microsoft.DotNet.Cli.Build
public override bool Execute()
{
if (!(Channel.Equals("master") || Channel.Equals("main") || Channel.StartsWith("release")))
{
return true; // Skip copy to latest, we don't want to publish to arbitrary places
}
string targetFolder = $"{AzurePublisher.Product.Sdk}/{Channel}";
string targetVersionFile = $"{targetFolder}/{CommitHash}";