Skip to content

ci(handbook): split deploy by branch — staging→DEV, develop→PRD#693

Merged
TaprootFreak merged 3 commits into
stagingfrom
ci/handbook-deploy-branch-split
Jun 4, 2026
Merged

ci(handbook): split deploy by branch — staging→DEV, develop→PRD#693
TaprootFreak merged 3 commits into
stagingfrom
ci/handbook-deploy-branch-split

Conversation

@TaprootFreak
Copy link
Copy Markdown
Contributor

Problem

Der Handbook-Deploy triggerte bisher nur auf develop und fächerte diesen einen Run in beide Environments auf — beide Jobs pushten denselben Docker-Tag (:beta). Das koppelt DEV und PRD und führt zum Clobber: ein develop-Build überschreibt das dev-Image (und umgekehrt) auf Docker Hub, sobald sich Builds zeitlich überlappen.

Lösung: ein Environment pro Branch

Push auf baut aus deployt Tag Endpoint
staging staging DEV :beta dev-handbook.realunit.app
develop develop PRD :latest handbook.realunit.app

Änderungen

.github/workflows/handbook-deploy.yaml

  • Trigger auf [staging, develop] (+ workflow_dispatch, Ziel-Env nach dispatchtem Branch)
  • Routing je Branch über if: github.ref_name == 'staging' | 'develop'
  • In-Run-Kopplung (needs:/sequenziell) entfernt — die „DEV grün vor PRD"-Garantie liefert jetzt der Promotion-Flow selbst: Inhalt erreicht develop erst nach staging (via auto-staging-pr.yaml), also nach DEV-Build+Smoke
  • Concurrency-Gruppe pro Branch (handbook-deploy-${{ github.ref_name }}) → DEV und PRD blockieren/canceln sich nicht mehr gegenseitig
  • Getrennte Image-Tags (:beta DEV, :latest PRD) → kein Clobber mehr

.github/workflows/handbook.yaml

  • Neuer required Input ref; der Handbook-Checkout nutzt ihn → DEV baut den staging-Stand, PRD den develop-Stand (jeweils der triggernde Branch)
  • Der DFXswiss/api-Mail-Preview-Checkout bleibt für beide Envs auf develop gepinnt (er folgt dem Handbook-Branch-Split bewusst nicht) — klargestellt im Code-Kommentar

Doku: README-Workflow-Tabelle, docs/handbook/README.md Trigger-Sektion und zwei Prosa-Stellen in docs/handbook/de/index.html auf das neue Mapping aktualisiert.

Tag-Wahl / Server-Kompatibilität

Die Tags :beta (DEV) / :latest (PRD) entsprechen exakt dem bereits in README.md dokumentierten Mapping (der YAML war auf beide-:beta regressiert). Damit bleiben die serverseitigen Compose-Referenzen auf dfxdev/dfxprd gültig — keine Server-Änderung nötig.

Lokal verifiziert

  • actionlint sauber auf beiden geänderten Workflows (Reusable-Input-Verdrahtung inkl. neuem ref valide). Die einzigen Hinweise sind vorbestehende SC2012-infos in der nicht angefassten Mail-Preview-Stufe.
  • ✅ Beide Handbook-Generatoren sind No-ops auf der editierten index.html (Sync-Gates grün)
  • docker build -f Dockerfile.handbook + Container-Smoke (/healthz 200, /de/ 401) grün; geänderte Prosa im Image vorhanden
  • ✅ YAML-Parse OK

The handbook deploy used to trigger only on push to develop and fan that
single run out to BOTH environments, with both jobs pushing the same
Docker tag (:beta). That coupled the environments and let a develop build
clobber the dev image (and vice versa) on Docker Hub whenever builds
overlapped.

Split it into one environment per branch:
- push to staging → build from staging → deploy DEV  (dev-handbook.realunit.app, :beta)
- push to develop → build from develop → deploy PRD  (handbook.realunit.app,  :latest)

Changes:
- handbook-deploy.yaml: trigger on [staging, develop]; route each branch to
  its env via per-job 'if: github.ref_name == ...'; drop the in-run
  needs:/sequential coupling (the 'DEV green before PRD' guarantee now comes
  from the staging→develop promotion flow); per-branch concurrency group
  (handbook-deploy-<ref_name>) so DEV and PRD never block/cancel each other;
  distinct image tags per env (:beta DEV, :latest PRD) to stop the clobber.
- handbook.yaml: add a required 'ref' input and check out THIS repo at it,
  so DEV builds the staging 'Stand' and PRD the develop 'Stand'. The
  DFXswiss/api mail-preview checkout stays pinned to develop for both envs
  (it does not track the handbook branch split).
- docs: README workflow table, docs/handbook/README.md trigger section, and
  two handbook index.html prose spots updated to the new mapping.

The image tags (:beta DEV / :latest PRD) match the mapping already
documented in README.md, so the server-side compose references stay valid.

Verified locally: actionlint clean on the changed workflows (only
pre-existing SC2012 infos in the untouched mail-preview step), both
handbook generators are no-ops on the edited index.html (sync gates green),
docker build + container smoke pass.
Address review: update doc-comments that the branch split made inaccurate.
- handbook.yaml header: drop the 'fans out DEV→PRD with needs:' description,
  list the new 'ref' parameter, point at the promotion-flow guarantee.
- handbook-build-check.yaml header: 'develop push → DEV → PRD' →
  'staging push → DEV, develop push → PRD'.
- docs/handbook/README.md: golden-baseline pickup is staging→DEV / develop→PRD,
  not a develop push.
@TaprootFreak TaprootFreak marked this pull request as ready for review June 4, 2026 14:47
@TaprootFreak TaprootFreak merged commit 47792b5 into staging Jun 4, 2026
12 of 13 checks passed
@TaprootFreak TaprootFreak deleted the ci/handbook-deploy-branch-split branch June 4, 2026 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant