-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
47 lines (37 loc) · 1.46 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
RESET := $(shell tput -T linux sgr0)
TITLE := $(BOLD)$(PURPLE)
TEMPDIR = ./.tmp
ORG_NAME=$(shell git config --get remote.origin.url | cut -d/ -f4)
ifndef TEMPDIR
$(error TEMPDIR is not set)
endif
define title
@printf '$(TITLE)$(1)$(RESET)\n'
endef
ifeq "$(strip $(VERSION))" ""
override VERSION = $(shell git describe --always --tags --dirty)
endif
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "$(BOLD)$(CYAN)%-25s$(RESET)%s\n", $$1, $$2}'
$(TEMPDIR):
mkdir -p $(TEMPDIR)
.PHONY: bootstrap
bootstrap: $(TEMPDIR) ## Bootstrap build tools
GOBIN=$(shell realpath $(TEMPDIR)) go install github.com/goreleaser/goreleaser@main
.PHONY: binary
binary: ## Build snapshot binaries only
$(call title,Building snapshot artifacts)
# build release snapshots
ORG_NAME=$(ORG_NAME) $(TEMPDIR)/goreleaser build --single-target --clean --snapshot --config $(TEMPDIR)/goreleaser.yaml
.PHONY: build
build: ## Build snapshot release binaries and packages
$(call title,Building snapshot artifacts)
# build release snapshots
ORG_NAME=$(ORG_NAME) BUILD=true BUILD_GIT_TREE_STATE=$(GITTREESTATE) $(TEMPDIR)/goreleaser release --debug ${BUILD:+--skip-publish2} --skip=sign,publish --clean --snapshot --config $(TEMPDIR)/goreleaser.yaml
.PHONY: upstream-protobom
upstream-protobom: ## Upstream protobom library
go get github.com/protobom/protobom@main
.PHONY: unittest
unittest: ## Run unittests
go test -count=1 -v ./...