-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync eng/common directory with azure-sdk-tools for PR 1251 (#16290)
* Add PrepareRelease Script * Generalize Prepare-Release Script * Update Update-ChangeLog.ps1 * Update Package-Properties.ps1 * Update Collect-ChangeLog Script * Update Collect-ChangeLog.ps1 and Collect-Unreleased.ps1 * Update GeneralReleaseNotesParser.ps1 script * Update Prepare-Release Script to use recent DevOps Scripts * Move Get-LanguageName to eng\common\scripts\Helpers\DevOps-WorkItem-Helpers.ps1, improve error message, add logic to detect changes made by prepare-release script * Use LanguageDisplayName, move Get-CSVMetadata to Package-Properties.ps1 Co-authored-by: Chidozie Ononiwu <chononiw@microsoft.com>
- Loading branch information
1 parent
5483b6a
commit 91b3438
Showing
4 changed files
with
141 additions
and
12 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
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,109 @@ | ||
#Requires -Version 6.0 | ||
|
||
[CmdletBinding()] | ||
param( | ||
[Parameter(Mandatory=$true)] | ||
[string]$PackageName, | ||
[string]$ServiceDirectory, | ||
[string]$ReleaseDate, # Pass Date in the form MM/dd/yyyy" | ||
[string]$BuildType # For Java | ||
) | ||
|
||
. ${PSScriptRoot}\common.ps1 | ||
|
||
function Get-ReleaseDay($baseDate) | ||
{ | ||
# Find first friday | ||
while ($baseDate.DayOfWeek -ne 5) | ||
{ | ||
$baseDate = $baseDate.AddDays(1) | ||
} | ||
|
||
# Go to Tuesday | ||
$baseDate = $baseDate.AddDays(4) | ||
|
||
return $baseDate; | ||
} | ||
|
||
$ErrorPreference = 'Stop' | ||
|
||
$packageProperties = Get-PkgProperties -PackageName $PackageName -ServiceDirectory $serviceDirectory | ||
|
||
Write-Host "Source directory [ $serviceDirectory ]" | ||
|
||
if (!$ReleaseDate) | ||
{ | ||
$currentDate = Get-Date | ||
$thisMonthReleaseDate = Get-ReleaseDay((Get-Date -Day 1)); | ||
$nextMonthReleaseDate = Get-ReleaseDay((Get-Date -Day 1).AddMonths(1)); | ||
|
||
if ($thisMonthReleaseDate -ge $currentDate) | ||
{ | ||
# On track for this month release | ||
$ParsedReleaseDate = $thisMonthReleaseDate | ||
} | ||
elseif ($currentDate.Day -lt 15) | ||
{ | ||
# Catching up to this month release | ||
$ParsedReleaseDate = $currentDate | ||
} | ||
else | ||
{ | ||
# Next month release | ||
$ParsedReleaseDate = $nextMonthReleaseDate | ||
} | ||
} | ||
else | ||
{ | ||
$ParsedReleaseDate = ([datetime]$ReleaseDate, 'MM/dd/yyyy', [Globalization.CultureInfo]::InvariantCulture) | ||
} | ||
|
||
$releaseDateString = $ParsedReleaseDate.ToString("MM/dd/yyyy") | ||
$month = $ParsedReleaseDate.ToString("MMMM") | ||
|
||
Write-Host | ||
Write-Host "Assuming release is in $month with release date $releaseDateString" -ForegroundColor Green | ||
|
||
$currentProjectVersion = $packageProperties.Version | ||
|
||
$newVersion = Read-Host -Prompt "Input the new version, or press Enter to use use current project version '$currentProjectVersion'" | ||
|
||
if (!$newVersion) | ||
{ | ||
$newVersion = $currentProjectVersion; | ||
} | ||
|
||
$newVersionParsed = [AzureEngSemanticVersion]::ParseVersionString($newVersion) | ||
if ($null -eq $newVersionParsed) | ||
{ | ||
Write-Error "Invalid version $newVersion. Version must follow standard SemVer rules, see https://aka.ms/azsdk/engsys/packageversioning" | ||
exit 1 | ||
} | ||
|
||
if (Test-Path "Function:SetPackageVersion") | ||
{ | ||
SetPackageVersion -PackageName $packageProperties.Name -Version $newVersion -ServiceDirectory $serviceDirectory -ReleaseDate $releaseDateString ` | ||
-BuildType $BuildType -GroupId $packageProperties.Group | ||
} | ||
else | ||
{ | ||
LogError "The function 'SetPackageVersion' was not found.` | ||
Make sure it is present in eng/scripts/Language-Settings.ps1.` | ||
See https://github.com/Azure/azure-sdk-tools/blob/master/doc/common/common_engsys.md#code-structure" | ||
exit 1 | ||
} | ||
|
||
&$EngCommonScriptsDir/Update-DevOps-Release-WorkItem.ps1 ` | ||
-language $LanguageDisplayName ` | ||
-packageName $packageProperties.Name ` | ||
-version $newVersion ` | ||
-plannedDate $releaseDateString ` | ||
-packageRepoPath $packageProperties.serviceDirectory | ||
|
||
git diff -s --exit-code $packageProperties.DirectoryPath | ||
if ($LASTEXITCODE -ne 0) | ||
{ | ||
git status | ||
Write-Host "Some changes were made to the repo source" -ForegroundColor Green | ||
Write-Host "Submit a pull request with the necessary changes to the repo" -ForegroundColor Green | ||
} |
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