File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 1717 with :
1818 fetch-depth : 0
1919
20+ - name : Validate tag matches version in main.go
21+ run : |
22+ # Extract version from main.go
23+ VERSION=$(grep -E '^[[:space:]]*version[[:space:]]*=' main.go | sed -E 's/.*"([^"]+)".*/\1/')
24+
25+ # Get the tag name (remove refs/tags/ prefix)
26+ TAG_NAME=${GITHUB_REF#refs/tags/}
27+
28+ # Remove 'v' prefix from tag if present
29+ TAG_VERSION=${TAG_NAME#v}
30+
31+ echo "Version in main.go: $VERSION"
32+ echo "Tag version: $TAG_VERSION"
33+
34+ # Compare versions
35+ if [ "$VERSION" != "$TAG_VERSION" ]; then
36+ echo "ERROR: Tag version ($TAG_VERSION) does not match version in main.go ($VERSION)"
37+ echo "Please ensure the tag matches the version defined in main.go"
38+ exit 1
39+ fi
40+
41+ echo "✅ Tag version matches main.go version: $VERSION"
42+
2043 - name : Set up Go 1.23
2144 uses : actions/setup-go@v4
2245 with :
You can’t perform that action at this time.
0 commit comments