File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,13 +24,14 @@ jobs:
2424 fetch-depth : 1
2525
2626 - run : |
27+ . .\utilities.ps1 # Import the functions
28+
2729 $oldTag = "${{ github.event.client_payload.oldTag }}"
2830 $newTag = "${{ github.event.client_payload.newTag }}"
2931 echo "Updating examples version to $newTag"
3032 echo "Old version: $oldTag"
3133 echo "New version: $newTag"
3234
33- . .\utilities.ps1 # Import the functions
3435 dir -r .\package.json | % { update-files $_ -OldVersion $oldTag -NewVersion $newTag }
3536 dir -r .\docs\**\*.md | % { update-files $_ -OldVersion $oldTag -NewVersion $newTag }
3637 dir -r .github\**\*.yml | % { update-files $_ -OldVersion $oldTag -NewVersion $newTag }
Original file line number Diff line number Diff line change 2424 fetch-depth : 1
2525
2626 - run : |
27- $newTag = "${{ github.event.client_payload.tag }}"
28- $newTag = "${{ github.event.client_payload.newTag }}"
27+ . ./utilities.ps1 # Import the functions
28+
29+ $version = "${{ github.event.client_payload.newTag }}"
30+
31+ $oldTag = extract-version
32+ $newTag = ($version -split '\.')[0,1] -join '.' | % { "$_.x" }
33+
2934 echo "Updating GitVersion version to $newTag"
35+ echo "Old version: $oldTag"
36+ echo "New version: $newTag"
37+
38+ dir -r .\docs\**\*.md | % { update-files $_ -OldVersion $oldTag -NewVersion $newTag }
39+ dir -r .github\**\*.yml | % { update-files $_ -OldVersion $oldTag -NewVersion $newTag }
40+ dir -r .azure\**\*.yml | % { update-files $_ -OldVersion $oldTag -NewVersion $newTag }
41+
3042 name: Update GitVersion version
3143
3244 - uses : gittools/cicd/git-commit-push@main
Original file line number Diff line number Diff line change @@ -52,3 +52,19 @@ function publish-vsix()
5252
5353 echo " vsix=$vsix " >> $env: GITHUB_OUTPUT
5454}
55+
56+ function extract-version ()
57+ {
58+ $filePath = " .github/workflows/ci.yml"
59+ if (Test-Path $filePath ) {
60+ $content = Get-Content $filePath - Raw
61+ if ($content -match " versionSpec:\s*'([^']+)'" ) {
62+ $version = $Matches [1 ]
63+ Write-Output $version
64+ } else {
65+ Write-Error " Could not find versionSpec in $filePath "
66+ }
67+ } else {
68+ Write-Error " File not found: $filePath "
69+ }
70+ }
You can’t perform that action at this time.
0 commit comments