adding build script
Some checks failed
Build Website / build (push) Failing after 8s

This commit is contained in:
Jean-Michel Tremblay 2026-04-20 09:23:14 -04:00
parent cf0f67d91d
commit 9a00c0d480
2 changed files with 31 additions and 9 deletions

View file

@ -0,0 +1,24 @@
name: Build Website
on: [push]
jobs:
build:
runs-on: docker
steps:
- name: Checkout
run: |
git clone --branch ${{ github.ref_name }} ${{ github.server_url }}/${{ github.repository }}.git .
- name: Build
run: |
docker run --rm \
-v "$PWD/site:/src" \
-w /src \
ghcr.io/gohugoio/hugo:latest \
--minify --destination "public" --baseURL "/"
- name: Deploy
run: |
echo "${{ secrets.FORGEJO_SSH }}" > /tmp/deploy_key
chmod 600 /tmp/deploy_key
scp -i /tmp/deploy_key -o StrictHostKeyChecking=no -r site/public/. ${{ vars.JMOPINES_USER }}@${{ vars.JMOPINES_IP }}:/var/www/jmopines/
rm /tmp/deploy_key

View file

@ -1,11 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail
# Build and serve the Hugo site locally using Docker.
# Build the Hugo site into the `public/` directory for deployment (e.g. nginx).
# Usage: ./scripts/build.sh
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/../.env"
PORT="${1:-$PORT}"
if [[ ! -d "${SITE_DIR}" ]]; then
echo "[build] Site directory not found: ${SITE_DIR}"
@ -13,14 +12,13 @@ if [[ ! -d "${SITE_DIR}" ]]; then
exit 1
fi
echo "[build] Serving site at http://localhost:${PORT}/"
echo "[build] Press Ctrl+C to stop."
echo "[build] Building site into ${SITE_DIR}/public ..."
# Run Hugo in Docker to produce static files. This does not start the dev server.
docker run --rm \
-v "${SITE_DIR}:/src" \
-w /src \
-p "${PORT}:1313" \
"${HUGO_IMAGE}" server \
--bind 0.0.0.0 \
--baseURL "http://localhost:${PORT}/" \
--appendPort=false
"${HUGO_IMAGE}" \
--minify --destination "public" --baseURL "/"
echo "[build] Build complete: ${SITE_DIR}/public"