diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml index d6ee1d4f..bf2e78fb 100644 --- a/.github/workflows/pre-release.yaml +++ b/.github/workflows/pre-release.yaml @@ -78,8 +78,8 @@ jobs: id: get_latest_release run: | git fetch --tags --force - $latestTag = git describe --tags --abbrev=0 - if ($LASTEXITCODE -ne 0) { + $latestTag = git for-each-ref --sort=-creatordate --format '%(refname:short)' refs/tags --count 1 + if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrEmpty($latestTag)) { Write-Error "Failed to get latest tag. Error code: $LASTEXITCODE" exit 1 }