diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 0e4d8a0..d9bb651 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -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 \ No newline at end of file + 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 \ No newline at end of file