Fix: Re-enable host volume mount for Hugo project
All checks were successful
deploy-docs / build-and-deploy (push) Successful in 26s
All checks were successful
deploy-docs / build-and-deploy (push) Successful in 26s
This commit is contained in:
@@ -9,47 +9,23 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
image: hugomods/hugo:latest
|
image: hugomods/hugo:latest
|
||||||
# We only need to mount the deployment target
|
# We mount both the existing Hugo site structure and the deployment target
|
||||||
options: --user root -v /srv/caddy/sites:/deploy
|
options: --user root -v /srv/caddy/sites:/deploy -v /srv/dev/hugo/wiki:/hugo-site
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# 1. Checkout the base Hugo project (assuming it's named 'wiki' or similar on your Gitea)
|
- name: Checkout Docs Source
|
||||||
# We put it in the 'hugo-site' directory
|
|
||||||
- name: Checkout Hugo Framework
|
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
|
||||||
repository: wompmacho/wiki # Adjust this if your Hugo project repo is named differently
|
|
||||||
path: hugo-site
|
|
||||||
# If the wiki repo is private, we need a token to clone it.
|
|
||||||
# The default GITHUB_TOKEN usually has access to other repos in the same org.
|
|
||||||
token: ${{ github.token }}
|
|
||||||
submodules: true
|
|
||||||
|
|
||||||
# 2. Checkout THIS repository (the markdown content) into the 'docs-content' directory
|
- name: Sync Markdown to Hugo Site
|
||||||
- name: Checkout Docs Content
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
path: docs-content
|
|
||||||
|
|
||||||
# 3. Merge the content and build
|
|
||||||
- name: Sync Markdown and Build
|
|
||||||
run: |
|
run: |
|
||||||
# Ensure content directory exists in the Hugo project
|
# Clean the existing content in the mounted Hugo site
|
||||||
mkdir -p hugo-site/content
|
rm -rf /hugo-site/content/*
|
||||||
|
# Copy the new content from this repo into the Hugo content folder
|
||||||
# Clean old content
|
cp -r . /hugo-site/content/
|
||||||
rm -rf hugo-site/content/*
|
# Remove Git-related metadata from the content folder
|
||||||
|
rm -rf /hugo-site/content/.git /hugo-site/content/.gitea
|
||||||
# Copy new content from this repo to the Hugo content folder
|
|
||||||
cp -r docs-content/* hugo-site/content/
|
|
||||||
|
|
||||||
# Build the site
|
|
||||||
cd hugo-site
|
|
||||||
hugo --minify --destination public
|
|
||||||
|
|
||||||
# 4. Deploy to Caddy
|
- name: Build and Deploy Hugo
|
||||||
- name: Deploy to Caddy
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /deploy/wiki
|
cd /hugo-site
|
||||||
rm -rf /deploy/wiki/*
|
hugo --minify --destination /deploy/wiki
|
||||||
cp -r hugo-site/public/* /deploy/wiki/
|
|
||||||
|
|||||||
Reference in New Issue
Block a user