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 runs-on: ubuntu-latest
container: container:
image: hugomods/hugo:latest image: hugomods/hugo:latest
# We only mount the deployment target, we DO NOT mount the host's framework directory # Mount deployment target and the framework (Read-Only)
options: --user root -v /srv/caddy/sites:/deploy options: --user root -v /srv/caddy/sites:/deploy -v /srv/dev/hugo/wiki:/framework:ro
steps: steps:
# 1. Checkout the Framework from Gitea - name: Checkout Docs Source
- name: Checkout Hugo Framework
uses: actions/checkout@v4 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: Prepare, Build, and Deploy
- name: Checkout Docs Content
uses: actions/checkout@v4
with:
path: docs-content
# 3. Merge and Build
- name: Sync Markdown and Build
run: | 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 # Copy the read-only framework to a writable build directory
rm -f content static 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 mkdir -p content static
# Copy content from docs-content # Copy the new content from the docs repository
cp -r ../docs-content/* content/ 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 if [ -d "content/static" ]; then
cp -r content/static/* static/ cp -r content/static/* static/
rm -rf content/static rm -rf content/static
@@ -55,9 +46,7 @@ jobs:
# Build the site # Build the site
hugo --minify --destination public hugo --minify --destination public
# 4. Deploy to Caddy # Deploy to Caddy
- name: Deploy to Caddy
run: |
mkdir -p /deploy/wiki mkdir -p /deploy/wiki
rm -rf /deploy/wiki/* rm -rf /deploy/wiki/*
cp -r hugo-site/public/* /deploy/wiki/ cp -r public/* /deploy/wiki/