From 0189d4a95ac543989dc777486150ef3257efb1f9 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 6 Nov 2023 05:20:52 +0100 Subject: [PATCH] Load main version from AzDo server --- .../handle-versioning-accross-branches.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/handle-versioning-accross-branches.yml b/.github/workflows/handle-versioning-accross-branches.yml index 7906636..2ee2c24 100644 --- a/.github/workflows/handle-versioning-accross-branches.yml +++ b/.github/workflows/handle-versioning-accross-branches.yml @@ -19,7 +19,14 @@ jobs: - name: Get highest version number accross all branches id: get-version shell: pwsh + env: + AZURE_DEVOPS_CREATE_PAT: ${{ secrets.AZURE_DEVOPS_CREATE_PAT}} run: | + # get the last updated version for this extension from the server + $output = $(tfx extension show --token $env:AZURE_DEVOPS_CREATE_PAT --vsix $vsix --publisher "RobBos" --extension-id "GH… + $lastVersion = ($output.versions | Sort-Object -Property lastUpdated -Descending)[0] + Write-Host "Last version: [$($lastVersion.version)] from server" + # SemVer code function Parse-SemVer ($version) { $parts = $version.Split('.') @@ -42,20 +49,18 @@ jobs: # checkout the branch git checkout $branch - # get the semantic version number from the vss-extension-dev.json file - $version = Get-Content -Path "vss-extension.json" | ConvertFrom-Json | Select-Object -ExpandProperty version + # get the semantic version number from the version in the dependencyReviewTask/task.json file + $version = Get-Content -Path "dependencyReviewTask/task.json" | ConvertFrom-Json | Select-Object -ExpandProperty version Write-Host "Found version: [$version] in branch: [$branch]" # check if the version is semantically higher than the highest version using SemVer - $version = Parse-SemVer $version - if ($version.Major -gt $highestVersion.Major -or ($version.Major -eq $highestVersion.Major -and $version.Minor -gt $highestVersion.Minor) -or ($version.Major -eq $highestVersion.Major -and $version.Minor -eq $highestVersion.Minor -and $version.Patch -gt $highestVersion.Patch)) { $highestVersion = $version - Write-Host "New highest version: [$($highestVersion.Major).$($highestVersion.Minor).$($highestVersion.Patch)]" + Write-Host "New highest version from PR task.json: [$($highestVersion.Major).$($highestVersion.Minor).$($highestVersion.Patch)]" } }