chore: Add release action in Makefile
All checks were successful
/ pre-commit (push) Successful in 1m13s
All checks were successful
/ pre-commit (push) Successful in 1m13s
Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
parent
dc80145005
commit
792eff78cc
2 changed files with 9 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,4 +1,5 @@
|
||||||
bin
|
bin
|
||||||
|
releases
|
||||||
collerd.db
|
collerd.db
|
||||||
!docker/collerd.json
|
!docker/collerd.json
|
||||||
collerd.json
|
collerd.json
|
||||||
|
|
9
Makefile
9
Makefile
|
@ -1,6 +1,8 @@
|
||||||
APPVERSION := $(shell cat ./VERSION)
|
APPVERSION := $(shell cat ./VERSION)
|
||||||
GOVERSION := $(shell go version | awk '{print $$3}')
|
GOVERSION := $(shell go version | awk '{print $$3}')
|
||||||
GITCOMMIT := $(shell git log -1 --oneline | awk '{print $$1}')
|
GITCOMMIT := $(shell git log -1 --oneline | awk '{print $$1}')
|
||||||
|
OS := $(shell uname -s | tr [A-Z] [a-z])
|
||||||
|
ARCH := $(shell uname -m | tr [A-Z] [a-z])
|
||||||
LDFLAGS = -X main.AppVersion=${APPVERSION} -X main.GoVersion=${GOVERSION} -X main.GitCommit=${GITCOMMIT}
|
LDFLAGS = -X main.AppVersion=${APPVERSION} -X main.GoVersion=${GOVERSION} -X main.GitCommit=${GITCOMMIT}
|
||||||
|
|
||||||
.PHONY: clean test
|
.PHONY: clean test
|
||||||
|
@ -12,6 +14,11 @@ build:
|
||||||
&& go build -ldflags "${LDFLAGS}" -o ../bin/coller cmd/coller/main.go \
|
&& go build -ldflags "${LDFLAGS}" -o ../bin/coller cmd/coller/main.go \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
archive:
|
||||||
|
(mkdir -p releases && cd bin && tar cvzpf ../releases/coller-${APPVERSION}-${OS}-${ARCH}.tar.gz * && cd ../releases && sha256sum *.tar.gz)
|
||||||
|
|
||||||
|
release: build archive
|
||||||
|
|
||||||
test:
|
test:
|
||||||
(cd src \
|
(cd src \
|
||||||
&& go test internal/*.go \
|
&& go test internal/*.go \
|
||||||
|
@ -19,4 +26,4 @@ test:
|
||||||
)
|
)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf bin
|
rm -rf bin releases
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue