瀏覽代碼

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 年之前
父節點
當前提交
5064991533
共有 1 個文件被更改,包括 6 次插入2 次删除
  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)
           }