thermograph/.forgejo/workflows/frontend-deploy.yml
Emi Griffith 7b2db07722 CI: port the split repos' workflows to per-domain path-filtered monorepo pipelines
One root workflow set replaces the four repos' copies (deleted -- root-only
is where Forgejo reads them, and dead copies are a trap): per-domain
build-push with explicit image paths (emi/thermograph/backend|frontend; the
old github.repository-derived path collides in a monorepo), path-filtered
per-domain beta/prod/dev deploys, a domain-input reusable build check, a
single always-reporting PR gate (path-filtered required checks deadlock
auto-merge), a new infra-sync pipeline (host checkout + secrets render on
infra/** pushes), and ports of secrets-guard / ops-cron /
observability-validate to monorepo paths.
2026-07-22 22:11:33 -07:00

60 lines
2.4 KiB
YAML

name: Deploy frontend to beta VPS
# On a push to `main` that touches frontend/**, SSH to beta and roll ONLY the
# frontend service onto the image frontend-build-push.yml just published for
# this commit. Backend is deployed independently by backend-deploy.yml --
# the FE/BE CI-CD split survives reunification intact: a frontend change ships
# without touching backend and vice versa. infra/deploy/deploy.sh persists
# each service's live tag host-side, so a single-service roll never disturbs
# the other. An infra-only push rolls nothing (infra-sync.yml syncs the
# host checkouts instead); a mixed frontend+backend push fires both deploy
# workflows, serialized host-side by deploy.sh's flock.
#
# The SSH_HOST/USER/KEY/PORT secrets point at beta. appleboy/ssh-action is
# referenced by full GitHub URL because it isn't mirrored in Forgejo's default
# action registry.
#
# The tag MUST match frontend-build-push.yml's `sha-${GITHUB_SHA:0:12}` (12
# hex), not the full 40-char ${{ github.sha }} -- default Actions expressions
# have no substring function, so the compute step below truncates it.
# deploy.sh also retries the pull for ~5 min because Forgejo `needs:` can't
# gate across the separate build-push workflow, so this push's build may still
# be in flight.
#
# Frontend's own register() fetches the IndexNow key from backend at boot, so
# deploy.sh waits on a healthy backend before declaring the frontend roll OK
# (its compose depends_on already encodes that ordering).
on:
push:
branches: [main]
paths: ['frontend/**']
workflow_dispatch: {}
concurrency:
group: beta-deploy-frontend
cancel-in-progress: false
jobs:
deploy:
runs-on: docker
steps:
- name: Compute image tag
id: tag
run: echo "tag=sha-${GITHUB_SHA:0:12}" >> "$GITHUB_OUTPUT"
- name: Deploy frontend over SSH
uses: https://github.com/appleboy/ssh-action@v1.2.0
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
# Forward the target service + the image tag to run. deploy.sh reads
# FRONTEND_IMAGE_TAG and rolls just `frontend`.
envs: SERVICE,FRONTEND_IMAGE_TAG
script: /opt/thermograph/infra/deploy/deploy.sh
env:
SERVICE: frontend
FRONTEND_IMAGE_TAG: ${{ steps.tag.outputs.tag }}