Files

Deploy Static Pages Action

Custom Gitea Action for building and deploying static web applications (Vite, Lit, React, Flutter Web, Astro, vanilla HTML) as Docker containers with Traefik ingress on TrueNAS SCALE.

Features

  • Zero-Boilerplate Containerization: Dynamically creates a multi-stage Nginx container with SPA routing, gzip, PWA cache policies, and security headers.
  • Auto-Configured Ingress: Generates Traefik routing labels using target domain/subdomain on the apps-net Docker network.
  • Direct Registry Publishing: Authenticates and pushes images directly to Gitea Container Registry (git.rodydavis.dev).
  • Seamless TrueNAS Deployment: Securely transfers docker-compose.yml to TrueNAS SCALE and pulls/restarts the service.

Inputs

Name Description Default Required
path Path to static build output directory (./dist, ./build/web, ./public) ./dist No
domain Target URL/domain for Traefik router (e.g. myapp.rodydavis.dev, pocketpiano.app) <repo-name>.rodydavis.dev No
app_name Container and directory name <repo-name> No
git_token Gitea token with package write permissions "" No
ssh_key SSH private key for TrueNAS SCALE "" No
registry Container registry host git.rodydavis.dev No
host TrueNAS host IP/domain 10.0.0.218 No
user TrueNAS SSH user root No
network Docker external network for Traefik apps-net No
spa Enable SPA fallback (try_files $uri $uri/ /index.html) true No
push_image Push built image to container registry true No
deploy Deploy to TrueNAS true No

Usage Examples

1. Node / Vite / Lit / TypeScript App

name: Build and Deploy

on:
  push:
    branches: ["main", "master"]
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: 'npm'

      - run: npm ci && npm run build

      - name: Deploy Static Pages
        uses: https://git.rodydavis.dev/rodydavis/shared-actions/pages-deploy@main
        with:
          path: './dist'
          domain: 'bullmastiff.rodydavis.dev'
          git_token: ${{ secrets.GIT_TOKEN }}
          ssh_key: ${{ secrets.TRUENAS_SSH_KEY }}

2. Flutter Web App

name: Build and Deploy

on:
  push:
    branches: ["main", "master"]
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: https://git.rodydavis.dev/rodydavis/shared-actions/setup-flutter@main

      - run: |
          flutter pub get
          flutter build web --release

      - name: Deploy Static Pages
        uses: https://git.rodydavis.dev/rodydavis/shared-actions/pages-deploy@main
        with:
          path: './build/web'
          domain: 'flow-image-editor.rodydavis.dev'
          git_token: ${{ secrets.GIT_TOKEN }}
          ssh_key: ${{ secrets.TRUENAS_SSH_KEY }}