#!/bin/sh

# Exit immediately if a command exits with a non-zero status.
set -e

# Log the start of the build process
echo "Starting build process..."

# Log the beginning of CSS compilation and data preparation
echo "Running pre-build tasks..."
yarn run prebuild
echo "Pre-build tasks completed successfully."

# Log the beginning of CSS building
echo "Building CSS..."
yarn run build
echo "CSS building completed successfully."

# Log the beginning of Hugo production build
echo "Generating production build with Hugo..."
# Assuming Hugo is installed and available in the environment or Docker image
hugo --minify --environment production --config hugo.toml
echo "Hugo production build completed successfully."

# Log the successful completion of the build process
echo "Build process completed successfully!"
