Fix workflow: Use local read-only mount to prevent Git auth errors
All checks were successful
deploy-docs / build-and-deploy (push) Successful in 23s

and protect host symlinks
This commit is contained in:
2026-03-25 00:47:11 +00:00
parent 88df4ca8ed
commit 8f298e86d9

View File

@@ -9,41 +9,32 @@ jobs:
runs-on: ubuntu-latest
container:
image: hugomods/hugo:latest
# We only mount the deployment target, we DO NOT mount the host's framework directory
options: --user root -v /srv/caddy/sites:/deploy
# Mount deployment target and the framework (Read-Only)
options: --user root -v /srv/caddy/sites:/deploy -v /srv/dev/hugo/wiki:/framework:ro
steps:
# 1. Checkout the Framework from Gitea
- name: Checkout Hugo Framework
- name: Checkout Docs Source
uses: actions/checkout@v4
with:
repository: wompmacho/hugo-framework
path: hugo-site
# The default token has access to other repos owned by the user
token: ${{ github.token }}
submodules: true
# 2. Checkout the Content
- name: Checkout Docs Content
uses: actions/checkout@v4
with:
path: docs-content
# 3. Merge and Build
- name: Sync Markdown and Build
- name: Prepare, Build, and Deploy
run: |
cd hugo-site
# Save the path to the checked-out docs
DOCS_DIR=$(pwd)
# Remove the symlinks that were committed to the framework repo
rm -f content static
# Copy the read-only framework to a writable build directory
cp -r /framework /tmp/hugo-build
cd /tmp/hugo-build
# Create real folders
# Remove the symlinks that were copied from the host
rm -rf content static
# Create real folders for the build
mkdir -p content static
# Copy content from docs-content
cp -r ../docs-content/* content/
# Copy the new content from the docs repository
cp -r $DOCS_DIR/* content/
# Move static assets if they exist inside the copied content
# Move static assets if they exist in the docs
if [ -d "content/static" ]; then
cp -r content/static/* static/
rm -rf content/static
@@ -55,9 +46,7 @@ jobs:
# Build the site
hugo --minify --destination public
# 4. Deploy to Caddy
- name: Deploy to Caddy
run: |
# Deploy to Caddy
mkdir -p /deploy/wiki
rm -rf /deploy/wiki/*
cp -r hugo-site/public/* /deploy/wiki/
cp -r public/* /deploy/wiki/