All checks were successful
deploy-docs / build-and-deploy (push) Successful in 19s
59 lines
1.9 KiB
YAML
59 lines
1.9 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 using dynamic environment variable overrides
|
|
HUGO_PARAMS_ARTICLE_EDITURL="https://git.wompmacho.com/wompmacho/docs-public/src/branch/main" hugo --minify --destination public
|
|
|
|
# Deploy to Caddy
|
|
mkdir -p /deploy/wiki
|
|
rm -rf /deploy/wiki/*
|
|
cp -r public/* /deploy/wiki/
|