Initial logic is implemented
This commit is contained in:
18
scripts/build
Executable file
18
scripts/build
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
PACKAGE="git.badhouseplants.net/allanger/giops"
|
||||
VERSION="$(git describe --tags --always --abbrev=0 --match='v[0-9]*.[0-9]*.[0-9]*' 2> /dev/null | sed 's/^.//')"
|
||||
COMMIT_HASH="$(git rev-parse --short HEAD)"
|
||||
BUILD_TIMESTAMP=$(date '+%Y-%m-%dT%H:%M:%S')
|
||||
|
||||
# STEP 2: Build the ldflags
|
||||
|
||||
LDFLAGS=(
|
||||
"-X '${PACKAGE}/internal/build.Version=${VERSION}'"
|
||||
"-X '${PACKAGE}/internal/build.CommitHash=${COMMIT_HASH}'"
|
||||
"-X '${PACKAGE}/internal/build.BuildTime=${BUILD_TIMESTAMP}'"
|
||||
)
|
||||
|
||||
# STEP 3: Actual Go build process
|
||||
|
||||
go build -ldflags="${LDFLAGS[*]}"
|
Reference in New Issue
Block a user