Fix workflow: Use isolated git clones instead of host mounts for
Some checks failed
deploy-docs / build-and-deploy (push) Failing after 26s
Some checks failed
deploy-docs / build-and-deploy (push) Failing after 26s
build
This commit is contained in:
@@ -9,36 +9,55 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: hugomods/hugo:latest
|
image: hugomods/hugo:latest
|
||||||
# We mount both the existing Hugo site structure and the deployment target
|
# We only mount the deployment target, we DO NOT mount the host's framework directory
|
||||||
options: --user root -v /srv/caddy/sites:/deploy -v /srv/dev/hugo/wiki:/hugo-site
|
options: --user root -v /srv/caddy/sites:/deploy
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Docs Source
|
# 1. Checkout the Framework from Gitea
|
||||||
|
- 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
|
||||||
|
|
||||||
- name: Sync Markdown and Assets to Hugo Site
|
# 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
|
||||||
run: |
|
run: |
|
||||||
# Clean the existing content and static in the mounted Hugo site
|
cd hugo-site
|
||||||
rm -rf /hugo-site/content/*
|
|
||||||
# The static symlink in hugo-site won't work inside the container context
|
|
||||||
# because the path '/srv/docs/public/static' doesn't exist inside the container.
|
|
||||||
# We must replace the symlink with a real folder for the build.
|
|
||||||
rm -f /hugo-site/static
|
|
||||||
mkdir -p /hugo-site/static
|
|
||||||
|
|
||||||
# Copy the new content from this repo into the Hugo content folder
|
# Remove the symlinks that were committed to the framework repo
|
||||||
cp -r . /hugo-site/content/
|
rm -f content static
|
||||||
|
|
||||||
# Copy static files if they exist in this repo
|
# Create real folders
|
||||||
if [ -d "./static" ]; then
|
mkdir -p content static
|
||||||
cp -r ./static/* /hugo-site/static/
|
|
||||||
|
# Copy content from docs-content
|
||||||
|
cp -r ../docs-content/* content/
|
||||||
|
|
||||||
|
# Move static assets if they exist inside the copied content
|
||||||
|
if [ -d "content/static" ]; then
|
||||||
|
cp -r content/static/* static/
|
||||||
|
rm -rf content/static
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove Git-related metadata from the content folder
|
# Clean git metadata
|
||||||
rm -rf /hugo-site/content/.git /hugo-site/content/.gitea
|
rm -rf content/.git content/.gitea
|
||||||
rm -rf /hugo-site/content/static
|
|
||||||
|
|
||||||
- name: Build and Deploy Hugo
|
# Build the site
|
||||||
|
hugo --minify --destination public
|
||||||
|
|
||||||
|
# 4. Deploy to Caddy
|
||||||
|
- name: Deploy to Caddy
|
||||||
run: |
|
run: |
|
||||||
cd /hugo-site
|
mkdir -p /deploy/wiki
|
||||||
hugo --minify --destination /deploy/wiki
|
rm -rf /deploy/wiki/*
|
||||||
|
cp -r hugo-site/public/* /deploy/wiki/
|
||||||
|
|||||||
Reference in New Issue
Block a user