50 lines
1.5 KiB
YAML
50 lines
1.5 KiB
YAML
name: Build and deploy Hugo site
|
|
on: [push]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: act_runner1
|
|
steps:
|
|
- name: Checkout repository (shell)
|
|
run: |
|
|
set -e
|
|
# If repository already checked out on the runner, use it
|
|
if [ -d .git ]; then
|
|
echo "Repository already present"
|
|
git status --porcelain || true
|
|
else
|
|
# Use provided repository URL (fallback to common CI env var if present)
|
|
REPO_URL="http://192.168.8.126:3000/blogs/outcomes.git"
|
|
if [ -n "${CI_REPOSITORY_URL:-}" ]; then
|
|
REPO_URL="${CI_REPOSITORY_URL}"
|
|
fi
|
|
if [ -n "$REPO_URL" ]; then
|
|
echo "Cloning $REPO_URL"
|
|
git clone --depth=1 "$REPO_URL" .
|
|
else
|
|
echo "No repository URL found in environment; proceeding with current directory"
|
|
fi
|
|
fi
|
|
|
|
- name: Pull Hugo Docker image
|
|
run: |
|
|
set -e
|
|
IMAGE=192.168.254.5:5000/hugo:v0.163.3
|
|
echo "Pulling $IMAGE"
|
|
docker pull "$IMAGE"
|
|
|
|
- name: Build site with Hugo (Docker)
|
|
run: |
|
|
set -e
|
|
IMAGE=192.168.254.5:5000/hugo:v0.163.3
|
|
# Ensure public directory exists and is writable
|
|
mkdir -p public
|
|
docker run --rm \
|
|
-v "$PWD":/src \
|
|
-v "$PWD"/public:/target \
|
|
"$IMAGE" hugo -s /src -d /target --minify
|
|
|
|
- name: Show generated files
|
|
run: |
|
|
echo "Public directory contents:"
|
|
ls -la public || true |