-
Notifications
You must be signed in to change notification settings - Fork 787
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[repo] Improve the scripts used in the release process (#5561)
- Loading branch information
1 parent
efe97bf
commit 994b890
Showing
5 changed files
with
129 additions
and
98 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 |
---|---|---|
@@ -1,31 +1,39 @@ | ||
# After every stable release, all PublicApi text files (Shipped & Unshipped) should be merged. | ||
$path = "src\*\.publicApi\**\"; | ||
$directory = Split-Path -Path $PSScriptRoot -Parent; | ||
param( | ||
[Parameter(Mandatory=$true)][string]$minVerTagPrefix | ||
) | ||
|
||
$searchPath = Join-Path -Path $directory -ChildPath $path; | ||
Write-Host "Search Directory: $searchPath"; | ||
Write-Host ""; | ||
# For stable releases "Unshipped" PublicApi text files are merged into "Shipped" versions. | ||
|
||
Get-ChildItem -Path $searchPath -Recurse -Filter *.Shipped.txt | | ||
ForEach-Object { | ||
Write-Host $_.FullName; | ||
$projectDirs = Get-ChildItem -Path src/**/*.csproj | Select-String "<MinVerTagPrefix>$minVerTagPrefix</MinVerTagPrefix>" -List | Select Path | Split-Path -Parent | ||
|
||
[string]$shipped = $_.FullName; | ||
[string]$unshipped = $shipped -replace ".shipped.txt", ".Unshipped.txt"; | ||
$path = "\.publicApi\**\PublicAPI.Shipped.txt"; | ||
|
||
if (Test-Path $unshipped) { | ||
Write-Host $unshipped; | ||
foreach ($projectDir in $projectDirs) { | ||
$searchPath = Join-Path -Path $projectDir -ChildPath $path; | ||
|
||
Get-Content $shipped, $unshipped | # get contents of both text files | ||
Where-Object {$_ -ne ""} | # filter empty lines | ||
Sort-Object | # sort lines | ||
Get-Unique | # filter duplicates | ||
Set-Content $shipped; # write to shipped.txt | ||
Write-Host "Search glob: $searchPath"; | ||
|
||
Clear-Content $unshipped; # empty unshipped.txt | ||
Get-ChildItem -Path $searchPath -Recurse | | ||
ForEach-Object { | ||
Write-Host "Shipped: $_"; | ||
|
||
Write-Host "...MERGED and SORTED"; | ||
} | ||
[string]$shipped = $_.FullName; | ||
[string]$unshipped = $shipped -replace ".shipped.txt", ".Unshipped.txt"; | ||
|
||
if (Test-Path $unshipped) { | ||
Write-Host "Unshipped: $unshipped"; | ||
|
||
Get-Content $shipped, $unshipped | # get contents of both text files | ||
Where-Object {$_ -ne ""} | # filter empty lines | ||
Sort-Object | # sort lines | ||
Get-Unique | # filter duplicates | ||
Set-Content $shipped; # write to shipped.txt | ||
|
||
Write-Host ""; | ||
} | ||
Clear-Content $unshipped; # empty unshipped.txt | ||
|
||
Write-Host "...MERGED and SORTED"; | ||
} | ||
|
||
Write-Host ""; | ||
} | ||
} |
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( | ||
[Parameter(Mandatory=$true)][string]$minVerTagPrefix | ||
) | ||
|
||
$projectDirs = Get-ChildItem -Path src/**/*.csproj | Select-String "<MinVerTagPrefix>$minVerTagPrefix</MinVerTagPrefix>" -List | Select Path | Split-Path -Parent | ||
|
||
foreach ($projectDir in $projectDirs) { | ||
$path = Join-Path -Path $projectDir -ChildPath "CHANGELOG.md" | ||
|
||
$directory = Split-Path $Path -Parent | Split-Path -Leaf | ||
|
||
$lines = Get-Content -Path $path | ||
|
||
$headingWritten = $false | ||
$started = $false | ||
$content = "" | ||
|
||
foreach ($line in $lines) | ||
{ | ||
if ($line -like "## Unreleased" -and $started -ne $true) | ||
{ | ||
$started = $true | ||
} | ||
elseif ($line -like "## *" -and $started -eq $true) | ||
{ | ||
break | ||
} | ||
else | ||
{ | ||
if ($started -eq $true) | ||
{ | ||
$content += $line + "`r`n" | ||
} | ||
} | ||
} | ||
|
||
if ([string]::IsNullOrWhitespace($content) -eq $false) | ||
{ | ||
Add-Content -Path ".\$($minVerTagPrefix)combinedchangelog.md" -Value "**$($directory)**" | ||
Add-Content -Path ".\$($minVerTagPrefix)combinedchangelog.md" -NoNewline -Value $content | ||
} | ||
} |
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,20 @@ | ||
param( | ||
[Parameter(Mandatory=$true)][string]$minVerTagPrefix, | ||
[Parameter(Mandatory=$true)][string]$version | ||
) | ||
|
||
$projectDirs = Get-ChildItem -Path src/**/*.csproj | Select-String "<MinVerTagPrefix>$minVerTagPrefix</MinVerTagPrefix>" -List | Select Path | Split-Path -Parent | ||
|
||
$content = "Unreleased | ||
## $version | ||
Released $(Get-Date -UFormat '%Y-%b-%d')" | ||
|
||
foreach ($projectDir in $projectDirs) { | ||
$path = Join-Path -Path $projectDir -ChildPath "CHANGELOG.md" | ||
|
||
Write-Host "Updating $path" | ||
|
||
(Get-Content -Path $path) -replace "Unreleased", $content | Set-Content -Path $path | ||
} |