read buildinfo json file from build artifact in TagNuGetClientGitRepostoryOnRelease script (#3870)

This commit is contained in:
Kartheek Penagamuri authored and GitHub committed 2021-01-29 10:57:37 -08:00
1 parent 07e555dd82
commit a6fc85c196
1 file changed
+12 -8
@@ -9,10 +9,13 @@ Uses the Personal Access Token of NuGetLurker to automate the tagging process.
PersonalAccessToken of the NuGetLurker account
.PARAMETER VsTargetBranch
The VS Branch that the NuGet build is being inserted into.
The VS Branch that the NuGet build is being inserted into.
.PARAMETER BuildOutputPath
The output path for NuGet Build artifacts.
.PARAMETER BuildInfoJsonFile
Path to the buildInfo.json file that is published as artifact for every build.
#>
[CmdletBinding()]
@@ -23,7 +26,9 @@ param
[Parameter(Mandatory=$True)]
[string]$VsTargetBranch,
[Parameter(Mandatory=$True)]
[string]$BuildOutputPath
[string]$BuildOutputPath,
[Parameter(Mandatory=$True)]
[string]$BuildInfoJsonFile
)
# Set security protocol to tls1.2 for Invoke-RestMethod powershell cmdlet
@@ -48,7 +53,6 @@ if($index -ne '-1')
$Date = Get-Date
$Message = "Insert $ProductVersion into $VsTargetBranch on $Date"
$BuildInfoJsonFile = [System.IO.Path]::Combine($BuildOutputPath, $Branch, $Build, 'buildinfo.json')
$buildInfoJson = (Get-Content $BuildInfoJsonFile -Raw) | ConvertFrom-Json
$LocRepoCommitHash = $buildInfoJson.LocalizationRepositoryCommitHash
@@ -76,12 +80,12 @@ try {
type = 'commit';
message= $TagMessage;
} | ConvertTo-Json;
Write-Host $Body
$tagObject = "refs/tags/$TagName"
$r1 = Invoke-RestMethod -Headers $Headers -Method Post -Uri "https://api.github.com/repos/NuGet/$NuGetRepository/git/tags" -Body $Body
Write-Host $r1
Write-Host $r1
}
catch {
# The above would fail if the tag already existed, in which case we would append the attempt number to the tag name to make it unique
@@ -93,9 +97,9 @@ catch {
type = 'commit';
message= $TagMessage;
} | ConvertTo-Json;
Write-Host $Body
$tagObject = "refs/tags/$TagName"
$r1 = Invoke-RestMethod -Headers $Headers -Method Post -Uri "https://api.github.com/repos/NuGet/$NuGetRepository/git/tags" -Body $Body
Write-Host $r1