#!/bin/sh
# script/cibuild: run the CI build. Runs script/bootstrap first (a pristine
# checkout has nothing installed, and script/fmt-check runs gofmt on the
# host), then script/check, then builds the image with --no-cache so the
# shipped image is built from a fresh run of its own gate phases. The Gitea
# workflow runs this on push.
set -eu

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd -P)"
ROOT="$(cd "$SCRIPT_DIR/.." && pwd -P)"

main() {
	cd "$ROOT"
	"$SCRIPT_DIR/bootstrap"
	"$SCRIPT_DIR/check"
	docker build --no-cache -t "$("$SCRIPT_DIR/projectname")" .
}

main "$@"
