Some checks failed
deploy-docs / build-and-deploy (push) Failing after 26s
build
64 lines
1.7 KiB
YAML
64 lines
1.7 KiB
YAML
name: deploy-docs
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
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
|
|
|
|
steps:
|
|
# 1. Checkout the Framework from Gitea
|
|
- name: Checkout Hugo Framework
|
|
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
|
|
run: |
|
|
cd hugo-site
|
|
|
|
# Remove the symlinks that were committed to the framework repo
|
|
rm -f content static
|
|
|
|
# Create real folders
|
|
mkdir -p content 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
|
|
|
|
# Clean git metadata
|
|
rm -rf content/.git content/.gitea
|
|
|
|
# Build the 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/
|