chore: support adding version at build time
This commit is contained in:
parent
35bce36222
commit
bd8537a334
2 changed files with 5 additions and 4 deletions
4
Makefile
4
Makefile
|
@ -1,13 +1,13 @@
|
||||||
.PHONY: all build clean
|
.PHONY: all build clean
|
||||||
|
|
||||||
PROJECT_NAME = $(shell head -n1 go.mod | cut -d'/' -f2)
|
PROJECT_NAME = $(shell head -n1 go.mod | cut -d'/' -f2)
|
||||||
|
VERSION ?= dev
|
||||||
|
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
# Build static executable
|
# Build static executable
|
||||||
build:
|
build:
|
||||||
CGO_ENABLED=0 go build
|
CGO_ENABLED=0 go build -ldflags "-X main.VERSION=${VERSION}"
|
||||||
strip $(PROJECT_NAME)
|
strip $(PROJECT_NAME)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
|
|
|
@ -13,7 +13,8 @@ import (
|
||||||
"recycled.cloud/app-exporter/apps"
|
"recycled.cloud/app-exporter/apps"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "0.1.0"
|
// var so it can be overridden at build time
|
||||||
|
var VERSION = "dev"
|
||||||
|
|
||||||
const LISTEN_ADDR = ":9404"
|
const LISTEN_ADDR = ":9404"
|
||||||
const INTERVAL = 24 * time.Hour
|
const INTERVAL = 24 * time.Hour
|
||||||
|
|
Loading…
Reference in a new issue