43 lines
1.0 KiB
YAML
43 lines
1.0 KiB
YAML
name: Build and Deploy Hugo Site
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout source
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0 # needed for .GitInfo and lastmod
|
|
|
|
- name: Setup Hugo
|
|
uses: peaceiris/actions-hugo@v3
|
|
with:
|
|
hugo-version: 'latest'
|
|
extended: true
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.22'
|
|
|
|
- name: Build site
|
|
run: hugo --minify --gc
|
|
|
|
- name: Deploy to Caddy site directory
|
|
run: |
|
|
set -euxo pipefail
|
|
echo "Start debugging"
|
|
# Runner is on the same host as Caddy.
|
|
# /deploy is mounted into the runner container → maps to /srv/docker/caddy/site on the host.
|
|
echo "Deploying to live site ..."
|
|
rm -rf /deploy-live/*
|
|
cp -a public/. /deploy-live/
|
|
echo "Deploy complete."
|