-
Notifications
You must be signed in to change notification settings - Fork 849
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add check release to auto trigger internal release job (#16207)
- Loading branch information
Showing
2 changed files
with
120 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
param ( | ||
$PackageName, | ||
$ServiceDirectory, | ||
$repoId | ||
) | ||
|
||
. (Join-Path $PSScriptRoot .. common scripts common.ps1) | ||
|
||
$apiUrl = "https://api.github.com/repos/$repoId" | ||
Write-Host "Using API URL $apiUrl" | ||
|
||
# VERIFY CHANGELOG | ||
$PackageProp = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $ServiceDirectory | ||
$changeLogEntries = Get-ChangeLogEntries -ChangeLogLocation $PackageProp.ChangeLogPath | ||
$changeLogEntry = $changeLogEntries[$PackageProp.Version] | ||
|
||
if (!$changeLogEntry) | ||
{ | ||
Write-Host "Changelog does not exist for package: $PackageName, version: $($PackageProp.Version)." | ||
Write-Output "##vso[task.setvariable variable=NeedToRelease;isOutput=true]false" | ||
return | ||
} | ||
|
||
if ([System.String]::IsNullOrEmpty($changeLogEntry.ReleaseStatus) -or $changeLogEntry.ReleaseStatus -eq $CHANGELOG_UNRELEASED_STATUS) | ||
{ | ||
Write-Host "Changelog is not in release status for package: $PackageName, version: $($PackageProp.Version)." | ||
Write-Output "##vso[task.setvariable variable=NeedToRelease;isOutput=true]false" | ||
return | ||
} | ||
|
||
# VERIFY TAG | ||
$existingTags = GetExistingTags($apiUrl) | ||
if ($existingTags -contains "$($PackageProp.Name)/v$($PackageProp.Version)") | ||
{ | ||
Write-Host "Package: $PackageName, version: $($PackageProp.Version) has already released." | ||
Write-Output "##vso[task.setvariable variable=NeedToRelease;isOutput=true]false" | ||
} | ||
else | ||
{ | ||
Write-Host "Package: $PackageName, version: $($PackageProp.Version) need to release." | ||
Write-Output "##vso[task.setvariable variable=NeedToRelease;isOutput=true]true" | ||
} |