Update build process and version embedding.

This commit is contained in:
2025-07-30 08:17:15 +02:00
parent e9d2634819
commit 2fe228858f
4 changed files with 27 additions and 5 deletions

View File

@@ -6,4 +6,17 @@ if [ $? -eq 0 ]; then
else
VERSION="dev"
fi
go build -ldflags "-X main.Version=$VERSION" -o lab-ca
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