From 5064991533307002ec640644dbe8798dc5e60c65 Mon Sep 17 00:00:00 2001 From: DerSkythe Date: Tue, 19 Dec 2023 10:53:56 +0400 Subject: [PATCH] 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. --- .github/workflows/build-with-firmwware.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-with-firmwware.yml b/.github/workflows/build-with-firmwware.yml index 17326bd..759d5ad 100644 --- a/.github/workflows/build-with-firmwware.yml +++ b/.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) }