check / check (push) Canceled after 0s
When VERSION is unset or empty, script/build now takes the version from `git describe --tags --always --dirty`, the form script/docker and script/cibuild use. Without --tags it ignored lightweight tags, so a binary from `make build` could report a commit where the image built from the same tree reported the tag. README.md Entrypoints names the same form. Model: opus-5-5
24 lines
712 B
Python
Executable File
24 lines
712 B
Python
Executable File
#!/bin/sh
|
|
# script/build: build the frontend for production into dist/, then the
|
|
# static netwatch-server binary into the repo root, with its version
|
|
# stamped in.
|
|
set -eu
|
|
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd -P)"
|
|
|
|
main() {
|
|
cd "$ROOT"
|
|
"$ROOT/script/yarn" build
|
|
|
|
# VERSION comes from the environment. Unset or empty, it is
|
|
# `git describe --tags --always --dirty`, as in script/docker, or
|
|
# "dev" where there is no git or no repository history.
|
|
version="${VERSION:-$(git describe --tags --always --dirty 2>/dev/null || echo dev)}"
|
|
|
|
CGO_ENABLED=0 go build -trimpath \
|
|
-ldflags "-s -w -X main.Version=$version" \
|
|
-o netwatch-server ./cmd/netwatch-server/
|
|
}
|
|
|
|
main "$@"
|