#!/bin/sh # Build script for lab-ca with version injection from git tag git describe --tags --always --dirty > /dev/null 2>&1 if [ $? -eq 0 ]; then VERSION=$(git describe --tags --always --dirty) else VERSION="dev" fi if echo $VERSION | grep -q 'dirty$'; then echo "Building in development mode, output directory is set to 'build'." OUTPUT_DIR=build # Make sure the output directory exists, create it if it is not mkdir -p $OUTPUT_DIR else echo "Building with version: $VERSION" OUTPUT_DIR=$GOHOME/bin fi # Build the Lab CA binary with version information go build -ldflags "-X main.Version=$VERSION" -o $OUTPUT_DIR/lab-ca