- adds a script to bump the minor version

Signed-off-by: Vincent Biret <vibiret@microsoft.com>
This commit is contained in:
Vincent Biret 2023-10-02 15:16:38 -04:00
Родитель a410216d1b
Коммит 4e69dfd841
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 32426322EDFFB7E3
3 изменённых файлов: 40 добавлений и 23 удалений

Просмотреть файл

@ -0,0 +1,15 @@
$indentContentScriptPath = Join-Path -Path $PSScriptRoot -ChildPath "indent-xml-content.ps1"
. $indentContentScriptPath
$mainCSProjpath = Join-Path -Path $PSScriptRoot -ChildPath "../src/kiota/kiota.csproj"
$mainCsprojContent = [xml](Get-Content -Path $mainCSProjpath)
$version = $mainCsprojContent.Project.PropertyGroup[0].VersionPrefix
$versionParts = $version.Split(".")
$versionParts[1] = [int]$versionParts[1] + 1
$version = $versionParts -join "."
$mainCsprojContent.Project.PropertyGroup[0].VersionPrefix = $version
Format-XMLIndent -Content $mainCsprojContent | Set-Content -Path $mainCSProjpath -Encoding utf8
$builderCSProjPath = Join-Path -Path $PSScriptRoot -ChildPath "../src/Kiota.Builder/Kiota.Builder.csproj"
$builderCsprojContent = [xml](Get-Content -Path $builderCSProjPath)
$builderCsprojContent.Project.PropertyGroup[0].VersionPrefix = $version
Format-XMLIndent -Content $builderCsprojContent | Set-Content -Path $builderCSProjPath -Encoding utf8

Просмотреть файл

@ -0,0 +1,22 @@
Function Format-XMLIndent {
param
(
[xml]$Content
)
# String Writer and XML Writer objects to write XML to string
$StringWriter = New-Object System.IO.StringWriter
$XmlWriter = New-Object System.XMl.XmlTextWriter $StringWriter
# Default = None, change Formatting to Indented
$xmlWriter.Formatting = "indented"
# Gets or sets how many IndentChars to write for each level in
# the hierarchy when Formatting is set to Formatting.Indented
$xmlWriter.Indentation = 2
$Content.WriteContentTo($XmlWriter)
$XmlWriter.Flush();
$StringWriter.Flush()
return $StringWriter.ToString()
}

Просмотреть файл

@ -5,28 +5,8 @@ param (
$date
)
Function Format-XMLIndent {
param
(
[xml]$Content
)
# String Writer and XML Writer objects to write XML to string
$StringWriter = New-Object System.IO.StringWriter
$XmlWriter = New-Object System.XMl.XmlTextWriter $StringWriter
# Default = None, change Formatting to Indented
$xmlWriter.Formatting = "indented"
# Gets or sets how many IndentChars to write for each level in
# the hierarchy when Formatting is set to Formatting.Indented
$xmlWriter.Indentation = 2
$Content.WriteContentTo($XmlWriter)
$XmlWriter.Flush();
$StringWriter.Flush()
return $StringWriter.ToString()
}
$indentContentScriptPath = Join-Path -Path $PSScriptRoot -ChildPath "indent-xml-content.ps1"
. $indentContentScriptPath
if ($date -eq $null -or $date -eq "") {
$date = Get-Date -Format "yyyy-MM-dd"
@ -36,7 +16,7 @@ if ($date -eq $null -or $date -eq "") {
$mainCSProjpath = Join-Path -Path $PSScriptRoot -ChildPath "../src/kiota/kiota.csproj"
$mainCsprojContent = [xml](Get-Content -Path $mainCSProjpath)
if ($version -eq $null -or $version -eq "") {
$version = $mainCsprojContent.Project.PropertyGroup.VersionPrefix
$version = $mainCsprojContent.Project.PropertyGroup[0].VersionPrefix
Write-Information "No version provided, using $version"
}
else {