Pre-release marker and build metadata are now properly separated per SemVer 2.0.0: 2.5.1-dev+76484c3 instead of 2.5.1+dev.76484c3. Consolidates version into a single string, removing separate Commit var. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
16 lines
544 B
Makefile
16 lines
544 B
Makefile
GO ?= go
|
|
EXECUTABLE := forgejo-mcp
|
|
COMMIT ?= $(shell git rev-parse --short HEAD)
|
|
VERSION ?= $(shell v=$$(git describe --tags --exact-match 2>/dev/null) && echo "$$v" | sed 's/^v//' || echo "$$(git describe --tags --abbrev=0 2>/dev/null | sed 's/^v//')-dev+$(COMMIT)")
|
|
LDFLAGS := -X "main.Version=$(VERSION)"
|
|
|
|
.PHONY: build
|
|
build:
|
|
$(GO) build -v -ldflags '-s -w $(LDFLAGS)' -o $(EXECUTABLE)
|
|
|
|
## vendor: tidy and verify module dependencies
|
|
.PHONY: vendor
|
|
vendor:
|
|
@echo 'Tidying and verifying module dependencies...'
|
|
go mod tidy
|
|
go mod verify
|