@@ -35,11 +35,32 @@ jobs:
3535 go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@latest
3636
3737 # Extract version number from tag (remove 'v' prefix)
38+ # Debug: Show what ref_name we got
39+ Write-Host "GitHub ref_name: ${{ github.ref_name }}"
40+ Write-Host "GitHub ref: ${{ github.ref }}"
41+ Write-Host "GitHub event_name: ${{ github.event_name }}"
42+
3843 $VERSION = "${{ github.ref_name }}" -replace '^v', ''
44+
45+ # Validate that we have a proper version format
46+ if ($VERSION -notmatch '^\d+\.\d+\.\d+') {
47+ Write-Host "ERROR: Invalid version format: $VERSION"
48+ Write-Host "Expected format: X.Y.Z (e.g., 1.0.4)"
49+ if ("${{ github.event_name }}" -eq "workflow_dispatch") {
50+ $VERSION = "${{ github.event.inputs.version }}" -replace '^v', ''
51+ Write-Host "Using workflow_dispatch version: $VERSION"
52+ } else {
53+ Write-Host "Extracting version from git tags..."
54+ $VERSION = (git describe --tags --abbrev=0) -replace '^v', ''
55+ Write-Host "Found version from git tags: $VERSION"
56+ }
57+ }
58+
59+ Write-Host "Using version: $VERSION"
3960 $VERSION_PARTS = $VERSION -split '\.'
40- $MAJOR = if ($VERSION_PARTS.Length -gt 0) { $VERSION_PARTS[0] } else { "1" }
41- $MINOR = if ($VERSION_PARTS.Length -gt 1) { $VERSION_PARTS[1] } else { "0" }
42- $PATCH = if ($VERSION_PARTS.Length -gt 2) { $VERSION_PARTS[2] } else { "0" }
61+ $MAJOR = if ($VERSION_PARTS.Length -gt 0 -and $VERSION_PARTS[0] -match '^\d+$' ) { $VERSION_PARTS[0] } else { "1" }
62+ $MINOR = if ($VERSION_PARTS.Length -gt 1 -and $VERSION_PARTS[1] -match '^\d+$' ) { $VERSION_PARTS[1] } else { "0" }
63+ $PATCH = if ($VERSION_PARTS.Length -gt 2 -and $VERSION_PARTS[2] -match '^\d+$' ) { $VERSION_PARTS[2] } else { "0" }
4364 $BUILD = "0"
4465
4566 # Create versioninfo.json with format expected by goversioninfo
0 commit comments