4e5346e2e0
- Added rsync installation in setup-env action for file synchronization. - Excluded playbook_websites.yml from ansible-apply-playbook workflow. - Created a new workflow for building and releasing the Hugo website. - Added submodule for Hugo theme in .gitmodules. - Updated host_vars for production to include websites configuration. - Introduced playbook_websites.yml for managing static files deployment. - Implemented hugo_build script for building and archiving Hugo sites. - Updated inventory to include a new web group for website deployment. - Refactored Terraform configuration to support new website structure. - Removed deprecated WordPress Terraform configuration. - Added .gitignore files for websites and specific Hugo site. - Created archetype and configuration files for the Hugo site. - Added static assets including CV and images for the Hugo site. - Integrated Hugo profile theme as a submodule for the website.
34 lines
1.2 KiB
Bash
Executable File
34 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# This script is used to build a Hugo site and prepare it for deployment.
|
|
GITHUB_WORKSPACE=${GITHUB_WORKSPACE:-$(pwd)}
|
|
|
|
command -v hugo >/dev/null 2>&1 || { echo >&2 "Hugo is not installed. Please install Hugo to use this script."; exit 1; }
|
|
|
|
mkdir -p "$GITHUB_WORKSPACE/websites/releases"
|
|
|
|
for dir in $(find "$GITHUB_WORKSPACE/websites" -maxdepth 1 -type d | grep -vE '^\.$'); do
|
|
if [ "$dir" == "$GITHUB_WORKSPACE/websites" ]; then
|
|
echo "Skipping $dir"
|
|
continue
|
|
fi
|
|
if [ "$dir" == "$GITHUB_WORKSPACE/websites/themes" ]; then
|
|
echo "Skipping $dir"
|
|
continue
|
|
fi
|
|
if [ "$dir" == "$GITHUB_WORKSPACE/websites/releases" ]; then
|
|
echo "Skipping $dir"
|
|
continue
|
|
fi
|
|
if [ -d "$dir" ]; then
|
|
echo "Building Hugo site in $dir"
|
|
cd "$dir" || exit 1
|
|
hugo --minify --themesDir $GITHUB_WORKSPACE/websites/themes --destination $GITHUB_WORKSPACE/websites/releases/$(basename "$dir") --baseURL "https://$(basename "$dir").example.com"
|
|
if [ $? -ne 0 ]; then
|
|
echo "Hugo build failed in $dir"
|
|
exit 1
|
|
fi
|
|
echo "Hugo site built successfully in $dir"
|
|
else
|
|
echo "$dir is not a directory"
|
|
fi
|
|
done |