Forráskód Böngészése

Improve version handling in firmware build workflow

This commit refines the version handling within the firmware build workflow. An empty string is initially assigned to the release version, then it's updated based on certain conditions. Consequently, the version input management is more accurate, securing the proper format for the release version.
DerSkythe 2 éve
szülő
commit
5064991533
1 módosított fájl, 6 hozzáadás és 2 törlés
  1. 6 2
      .github/workflows/build-with-firmwware.yml

+ 6 - 2
.github/workflows/build-with-firmwware.yml

@@ -99,7 +99,7 @@ jobs:
           cd '${{ env.APP_PATH }}'
           $sha = (git rev-parse --verify HEAD)
           
-          $releaseVersion = "$env:INPUT_VERSION"
+          $releaseVersion = ''
 
           if ( [string]::IsNullOrWhitespace($env:INPUT_VERSION) ) {
             $latestTag = ((gh release view --json tagName,url -R ${{ vars.REPO_SELF }}) | ConvertFrom-Json ).tagName
@@ -109,8 +109,12 @@ jobs:
             $minorValue = [Convert]::ToInt32($minorValue) + 1
             $latestTag = $latestTag.Substring(0, $lastIndex)
             
-            $releaseVersion = ('{0}.{1}', $latestTag, $minorValue.ToString())
+            $releaseVersion = ('{0}.{1}' -f $latestTag, $minorValue)
+          } else {
+            $releaseVersion = "$env:INPUT_VERSION"
           }
+          
+          Write-Output "::notice title=Obtain Version Number::$releaseVersion"
           if ( $releaseVersion.StartsWith('v') ) {
             $releaseVersion = $releaseVersion.Substring(1)
           }