Skip to content

Commit

Permalink
move update-version.ps1 to root
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Mar 11, 2024
1 parent 69d9146 commit b239891
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Expand Up @@ -41,7 +41,7 @@ jobs:
$minor = "${{steps.gitversion.outputs.minor}}"
$patch = "${{steps.gitversion.outputs.patch}}"
. .\dist\azure\update-version.ps1 # Import the functions
. .\update-version.ps1 # Import the functions
update-manifest .\dist\azure\vss-extension.json -Version $version
dir -r .\dist\**\task.json | % { update-task $_ -Major $major -Minor $minor -Patch $patch }
Expand Down
27 changes: 24 additions & 3 deletions dist/azure/update-version.ps1 → update-version.ps1
Expand Up @@ -22,7 +22,7 @@ function update-task() {
$jqPatch = '.version.Patch="' + $patch +'"';
Write-Host "Update task from $file to version $major.$minor.$patch"

Get-Content $file | jq $jqMajor | jq $jqMinor| jq $jqPatch | Set-Content $file
Get-Content $file | jq $jqMajor | jq $jqMinor | jq $jqPatch | Set-Content $file -NoNewline
}

function update-manifest() {
Expand All @@ -37,7 +37,28 @@ function update-manifest() {
)
$file = Resolve-Path $file
$jqVersion = '.version="' + $version +'"';
Write-Host "Update manifest version to $version"
Write-Host "Update manifest $file version to $version"

Get-Content $file | jq $jqVersion | Set-Content $file
Get-Content $file | jq $jqVersion | Set-Content $file -NoNewline
}

function update-md-files()
{
param(
[Parameter(Mandatory = $True, Position = 0, ValueFromPipeline = $true)]
[System.String]
$file,

[Parameter(Mandatory = $True, Position = 1, ValueFromPipeline = $false)]
[System.String]
$oldVersion,

[Parameter(Mandatory = $True, Position = 2, ValueFromPipeline = $false)]
[System.String]
$newVersion
)
$file = Resolve-Path $file
Write-Host "Update md file $file version from $oldVersion to $newVersion"

((Get-Content $file -Raw) -replace $oldVersion, $newVersion ) | Set-Content $file -NoNewline
}

0 comments on commit b239891

Please sign in to comment.