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 # 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 # 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/