Skip to content

Commit fdb87e4

Browse files
committed
feat: add release-tag Makefile target to create and push annotated tags
Add a release-tag target that validates VERSION, prevents overwriting existing tags, creates an annotated tag and pushes it to origin. Also include release-tag in .PHONY.
1 parent 1055c9a commit fdb87e4

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

Makefile

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build test clean run docker-build docker-run fmt vet tidy release-build
1+
.PHONY: build test clean run docker-build docker-run fmt vet tidy release-build release-tag
22

33
# Build the binary
44
build:
@@ -15,6 +15,27 @@ release-build:
1515
GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -trimpath -ldflags="-w -s" -o bin/release/mcp-vosdroits-windows-amd64.exe ./cmd/server
1616
@echo "Release binaries built in bin/release/"
1717

18+
# Create and push a release tag
19+
# Usage: make release-tag VERSION=v1.0.0
20+
release-tag:
21+
@if [ -z "$(VERSION)" ]; then \
22+
echo "❌ ERROR: VERSION is required. Usage: make release-tag VERSION=v1.0.0"; \
23+
exit 1; \
24+
fi
25+
@echo "Creating release tag $(VERSION)..."
26+
@if git rev-parse "$(VERSION)" >/dev/null 2>&1; then \
27+
echo "❌ ERROR: Tag $(VERSION) already exists"; \
28+
exit 1; \
29+
fi
30+
@git tag -a $(VERSION) -m "Release $(VERSION)"
31+
@echo "✅ Created tag $(VERSION)"
32+
@echo "Pushing tag to origin..."
33+
@git push origin $(VERSION)
34+
@echo "✅ Tag pushed successfully"
35+
@echo ""
36+
@echo "🚀 Release workflow triggered for $(VERSION)"
37+
@echo " Monitor: https://github.com/guigui42/mcp-vosdroits/actions"
38+
1839
# Run tests
1940
test:
2041
go test -v ./...

0 commit comments

Comments
 (0)