ci: build Hugo site in Docker image
Build and deploy Hugo site / build (push) Failing after 2s

This commit is contained in:
YaoLei
2026-07-02 17:32:15 +08:00
parent a26bb2acc0
commit f40d442a3d
+44 -6
View File
@@ -1,12 +1,50 @@
name: Cmd Test
name: Build and deploy Hugo site
on: [push]
jobs:
test:
build:
runs-on: act_runner1
steps:
- name: Run arbitrary command
- name: Checkout repository (shell)
run: |
echo "Hello from Gitea Actions"
date
uname -a
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