From ff12d77e3b9bde1fad38a1051b53a595bdae68ed Mon Sep 17 00:00:00 2001 From: wompmacho Date: Tue, 24 Mar 2026 23:52:03 +0000 Subject: [PATCH] Fix workflow to checkout Hugo repo dynamicall --- .gitea/workflows/deploy.yaml | 52 ++++++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 095a6c7..28f1546 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -9,23 +9,47 @@ jobs: runs-on: ubuntu-latest container: image: hugomods/hugo:latest - # Mount the Hugo site structure AND the deployment target - options: --user root -v /srv/caddy/sites:/deploy -v /srv/dev/hugo/wiki:/hugo-site + # We only need to mount the deployment target + options: --user root -v /srv/caddy/sites:/deploy steps: - - name: Checkout Docs Source + # 1. Checkout the base Hugo project (assuming it's named 'wiki' or similar on your Gitea) + # We put it in the 'hugo-site' directory + - name: Checkout Hugo Framework 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 - - name: Sync Markdown to Hugo Site - run: | - # Clean the existing content in the mounted Hugo site - rm -rf /hugo-site/content/* - # Copy the new content from this repo into the Hugo content folder - cp -r . /hugo-site/content/ - # Remove Git-related metadata from the content folder - rm -rf /hugo-site/content/.git /hugo-site/content/.gitea + # 2. Checkout THIS repository (the markdown content) into the 'docs-content' directory + - name: Checkout Docs Content + uses: actions/checkout@v4 + with: + path: docs-content - - name: Build and Deploy Hugo + # 3. Merge the content and build + - name: Sync Markdown and Build run: | - cd /hugo-site - hugo --minify --destination /deploy/wiki + # Ensure content directory exists in the Hugo project + mkdir -p hugo-site/content + + # Clean old content + rm -rf hugo-site/content/* + + # 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: Deploy to Caddy + run: | + mkdir -p /deploy/wiki + rm -rf /deploy/wiki/* + cp -r hugo-site/public/* /deploy/wiki/