Files
docs-public/.gitea/workflows/deploy.yaml
wompmacho 8c57fe074e
All checks were successful
deploy-docs / build-and-deploy (push) Successful in 22s
Feature: Add dynamic edit URLs and custom navigation menu
2026-03-25 03:12:21 +00:00

59 lines
1.7 KiB
YAML

name: deploy-docs
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
container:
image: hugomods/hugo:latest
# Mount deployment target and the framework (Read-Only)
options: --user root -v /srv/caddy/sites:/deploy -v /srv/dev/hugo/wiki:/framework:ro
steps:
- name: Checkout Docs Source
uses: actions/checkout@v4
- name: Prepare, Build, and Deploy
run: |
# Save the path to the checked-out docs
DOCS_DIR=$(pwd)
# Copy the read-only framework to a writable build directory
cp -r /framework /tmp/hugo-build
cd /tmp/hugo-build
# Remove the symlinks that were copied from the host
rm -rf content static
# Create real folders for the build
mkdir -p content static config/_default
# Copy the new content from the docs repository
cp -r $DOCS_DIR/* content/
# Move static assets if they exist in the docs
if [ -d "content/static" ]; then
cp -r content/static/* static/
rm -rf content/static
fi
# Move dynamic config overrides (e.g. menus.en.toml, params.toml) if they exist
if [ -d "content/config/_default" ]; then
cp -r content/config/_default/* config/_default/
rm -rf content/config
fi
# Clean git metadata
rm -rf content/.git content/.gitea
# Build the site
hugo --minify --destination public
# Deploy to Caddy
mkdir -p /deploy/wiki
rm -rf /deploy/wiki/*
cp -r public/* /deploy/wiki/