Report the version: docker build . stamps the git tag or short commit (closes #7)
check / check (push) Waiting to run
check / check (push) Waiting to run
attrsum --version now prints the git tag or short commit. make build stamps it with -X from git describe, and the Dockerfile takes the VERSION build argument when given, otherwise git describe --tags --always on the .git in the build context, failing if .git is present and no version comes out. A new .dockerignore, the canonical one, keeps .git/config out of the context, and also this repo's host-built /attrsum. CI checks out full history so it sees the 1.0.0 tag and stamps what a full clone does. script/docker is replaced with the canonical copy. Model: opus-5-5
This commit was merged in pull request #8.
This commit is contained in:
@@ -2,6 +2,11 @@
|
||||
|
||||
TESTDIR := $(HOME)/Documents/_SYSADMIN/cyberdyne
|
||||
|
||||
# The version `make build` stamps into the binary: the git tag or short
|
||||
# commit, -dirty with uncommitted changes. `make build VERSION=x` stamps x,
|
||||
# which is how the Dockerfile passes its version in.
|
||||
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
||||
|
||||
# Standard targets are thin shims; the implementations live in script/
|
||||
# per the scripts-to-rule-them-all pattern.
|
||||
|
||||
@@ -35,7 +40,7 @@ hooks:
|
||||
@script/install-precommit
|
||||
|
||||
build: clean
|
||||
@go build .
|
||||
@go build -ldflags "-X main.Version=$(VERSION)" .
|
||||
|
||||
clean:
|
||||
@rm -f attrsum
|
||||
|
||||
Reference in New Issue
Block a user