11SHELL := /bin/sh
22
33GO ?= go
4+ GORELEASER ?= goreleaser
45IMAGE ?= bering:dev
6+ DIST_DIR ?= dist
7+ VERSION ?= 0.0.0-dev
8+ CHART_VERSION ?= $(VERSION )
9+ BUILD_DATE ?= $(shell git show -s --format=% cI HEAD 2>/dev/null || date -u +"% Y-% m-% dT% H:% M:% SZ")
10+ GIT_SHA ?= $(shell git rev-parse --verify HEAD 2>/dev/null || echo unknown)
11+ GIT_TAG ?= v$(VERSION )
12+ IMAGE_REPOSITORY ?= ghcr.io/mb3r-lab/bering
13+ CHART_OCI_REPOSITORY ?= oci://ghcr.io/mb3r-lab/charts
14+ PUBLISH_OCI ?= 0
15+ ALLOW_CHART_VERSION_MISMATCH ?= 0
516
6- .PHONY : help lint test build run-checks docker-build clean
17+ BOOL_TRUE := 1 true TRUE yes YES
18+
19+ .PHONY : help lint test build run-checks docker-build goreleaser-release contracts-pack chart-package oci-image release-manifest validate-release release-dry-run release-local clean
720
821help :
922 @echo " Targets:"
10- @echo " lint Run gofmt and go vet"
11- @echo " test Run unit and integration tests"
12- @echo " build Build bering binary"
13- @echo " run-checks Run lint + test + build"
14- @echo " docker-build Build CLI image"
15- @echo " clean Remove generated binaries"
23+ @echo " lint Run gofmt and go vet"
24+ @echo " test Run unit and integration tests"
25+ @echo " build Build the local bering binary"
26+ @echo " run-checks Run lint + test + build"
27+ @echo " release-dry-run Build the release payload locally without publishing"
28+ @echo " release-local Build the canonical release payload and optionally publish OCI artifacts"
29+ @echo " chart-package Package the Helm chart and optionally publish it to an OCI registry"
30+ @echo " release-manifest Generate release-manifest.json and supporting metadata"
31+ @echo " validate-release Validate generated release metadata"
32+ @echo " docker-build Build the local CLI image"
33+ @echo " clean Remove generated binaries and release artifacts"
1634
1735lint :
1836 @fmt_out=" $$ (gofmt -l .)" ; \
@@ -28,13 +46,35 @@ test:
2846
2947build :
3048 mkdir -p bin
31- $(GO ) build -o bin/bering ./cmd/bering
49+ $(GO ) build -trimpath - o bin/bering ./cmd/bering
3250
3351run-checks : lint test build
3452
3553docker-build :
3654 docker build -f build/Dockerfile -t $(IMAGE ) .
3755
56+ goreleaser-release :
57+ rm -rf $(DIST_DIR )
58+ RELEASE_VERSION=$(VERSION ) $(GORELEASER ) release --snapshot --clean --skip=publish
59+
60+ contracts-pack :
61+ $(GO ) run ./cmd/releasectl contracts-pack --repo-root . --dist-dir $(DIST_DIR ) --app-version $(VERSION ) --build-date $(BUILD_DATE )
62+
63+ chart-package :
64+ $(GO ) run ./cmd/releasectl chart-package --repo-root . --dist-dir $(DIST_DIR ) --chart-dir charts/bering --app-version $(VERSION ) --chart-version $(CHART_VERSION ) --oci-repository $(CHART_OCI_REPOSITORY ) $(if $(filter $(BOOL_TRUE ) ,$(PUBLISH_OCI ) ) ,--publish,) $(if $(filter $(BOOL_TRUE ) ,$(ALLOW_CHART_VERSION_MISMATCH ) ) ,--allow-chart-version-mismatch,)
65+
66+ oci-image :
67+ $(GO ) run ./cmd/releasectl oci-image --repo-root . --dist-dir $(DIST_DIR ) --dockerfile build/Dockerfile --image-repository $(IMAGE_REPOSITORY ) --app-version $(VERSION ) --git-commit $(GIT_SHA ) --build-date $(BUILD_DATE ) $(if $(filter $(BOOL_TRUE ) ,$(PUBLISH_OCI ) ) ,--publish,)
68+
69+ release-manifest :
70+ $(GO ) run ./cmd/releasectl release-manifest --repo-root . --dist-dir $(DIST_DIR ) --app-version $(VERSION ) --git-commit $(GIT_SHA ) --git-tag $(GIT_TAG ) --build-date $(BUILD_DATE )
71+
72+ validate-release :
73+ $(GO ) run ./cmd/releasectl validate --repo-root . --dist-dir $(DIST_DIR ) --app-version $(VERSION ) --build-date $(BUILD_DATE ) $(if $(filter $(BOOL_TRUE ) ,$(PUBLISH_OCI ) ) ,--require-published-oci,) $(if $(filter $(BOOL_TRUE ) ,$(ALLOW_CHART_VERSION_MISMATCH ) ) ,--allow-chart-version-mismatch,)
74+
75+ release-dry-run : lint test goreleaser-release contracts-pack chart-package oci-image release-manifest validate-release
76+
77+ release-local : test goreleaser-release contracts-pack chart-package oci-image release-manifest validate-release
78+
3879clean :
3980 rm -rf bin out dist
40-
0 commit comments