mirror of
https://github.com/aphrody-labs/NuGet.Client.git
synced 2026-10-17 12:45:02 +00:00
read buildinfo json file from build artifact in TagNuGetClientGitRepostoryOnRelease script (#3870)
This commit is contained in:
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
|
||||
|
||||
Reference in new issue
Block a user