publish-static-site

Composite Gitea Action that builds and deploys static websites to the fritzlab k8s cluster.

Push HTML, Hugo, or MkDocs source to a repo in the websites org and get a live site with TLS automatically.

Usage

Add site.yaml to your repo root:

domain: my-site.fritzlab.net
type: static          # static | hugo | mkdocs
# content_dir: site   # subdirectory containing content (default: repo root)
# aliases:            # additional hostnames
#   - www.my-site.fritzlab.net
# tidy: true          # set false to skip HTML tidy
# enabled: true       # set false to decommission

Add .gitea/workflows/publish.yaml:

name: Publish
on:
  push:
    branches: [main]
jobs:
  publish:
    runs-on: fritzlab
    steps:
      - uses: actions/checkout@v4
      - uses: https://code.fritzlab.net/fritzlab/publish-static-site@v1
        with:
          token: ${{ secrets.CI_BOT_TOKEN }}

Add a DNS record:

my-site.fritzlab.net  300  IN  CNAME  traefik.edge.svc.k8s.sjc001.fritzlab.net.

Inputs

Input Required Default Description
token yes Gitea API token for registry push and apps repo
username no ci-bot Gitea username

Nginx config

Two optional files in your repo root override the default nginx behavior:

  • nginx-locations.conf — replaces the default location blocks entirely
  • nginx-extra.conf — added alongside location blocks (headers, rate limits, etc.)

Scripts

  • new-site.sh — scaffold a new site repo: ./new-site.sh --name my-site --domain my-site.fritzlab.net
  • publish.py decommission <site> — tear down a site without touching its repo

Architecture

push to websites/<repo>
  -> CI runs publish-static-site action
  -> reads site.yaml, builds content, runs tidy
  -> builds + pushes nginx image to registry
  -> stamps out k8s manifests in fritzlab/apps repo
  -> ArgoCD syncs -> site live with TLS
Description
Composite Gitea Action for publishing static websites to k8s
Readme 90 KiB
Languages
Python 72.9%
Jinja 12.9%
Shell 12.8%
Dockerfile 1.4%