CI: productie-deploy en productie-build alleen bij workflow_dispatch met deploy_production op een release/*-branch (gelijk aan ASF); documentatie bijgewerkt

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 16:48:55 +01:00
co-authored by Claude Sonnet 5.5
parent 0f3b7e0a2e
commit 02f3d9e931
3 changed files with 11 additions and 7 deletions
+7 -3
View File
@@ -172,7 +172,7 @@ jobs:
build-production:
needs: prepare
runs-on: linux
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_production == 'true'
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_production == 'true' && startsWith(github.ref, 'refs/heads/release/')
steps:
- uses: actions/checkout@v4
@@ -348,10 +348,14 @@ jobs:
# bewuste actie via workflow_dispatch met het "deploy_production"-vinkje
# aangevinkt. Zo blijft de bestaande testdeploy-flow ongewijzigd en kan
# niemand per ongeluk productie deployen door simpelweg naar master te
# pushen of de workflow handmatig te starten zonder dat vinkje.
# pushen of de workflow handmatig te starten zonder dat vinkje. Het vinkje
# werkt bovendien alleen op een branch die met release/ begint.
deploy-production:
needs: [build-production, test, lighthouse, config]
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_production == 'true'
# Alleen vanaf een release/*-branch (zoals de ASF-site): een dispatch met het
# vinkje op master of een feature-branch doet voor productie niets. Een push
# deployt nooit naar productie.
if: github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_production == 'true' && startsWith(github.ref, 'refs/heads/release/')
uses: ./.gitea/workflows/deploy.yaml
secrets: inherit
with:
@@ -6,7 +6,7 @@ Status on 2026-11-16: everything is merged to master and runs on TEST only. No p
## Before the release moment
- [ ] ASF IIS publish pipeline exists (own feature: self-contained win-x64 publish, FTP upload, web.config, the CMS host as the single entry for the website; open hosting questions are answered by trying it with ASF).
- [ ] Hero module feature decided (release with or without it).
- [ ] Hero module feature decided (release with or without it). SLS side: `docs/hero-integration.md`; production needs the seeded hero in the production CMS, the CMS host with the hero module, and the LCP check on the site afterwards.
- [ ] Privacy statement and static texts reviewed by the owner (kept aside until now).
- [ ] Captcha provider decided (Gitea issue #14, `docs/captcha-providers.md` in the CMS repo). Captcha stays OFF in production until then.
@@ -11,10 +11,10 @@ Sinds deze stap wordt er automatisch gedeployed naar een **testomgeving**: een R
- `continuous_integration.yaml` — getriggerd door `pull_request` (build/test/lint-gate, ongeacht branch), `push` naar `master` (build/test/lint-gate + `deploy-test`), en handmatig via `workflow_dispatch` (met een optioneel `deploy_production`-vinkje).
- Heeft bovenaan een `env:`-blok met alle aanpasbare waarden op één plek: `NODE_VERSION`, `PNPM_VERSION`, `ARTIFACT_NAME` (`dist`), `ARTIFACT_NAME_PRODUCTION` (`dist-production`), `ARTIFACT_PATH` (`dist/`), `DEPLOY_ENVIRONMENT` (`test`), `DEPLOY_PATH` (gelezen uit de Gitea repository variable `DEPLOY_PATH_TEST`, zie hieronder — bewust geen hardcoded pad), `DEPLOY_ENVIRONMENT_PRODUCTION` (`production`) en `DEPLOY_PATH_PRODUCTION` (gelezen uit de variable `DEPLOY_PATH_PRODUCTION`).
- `prepare` → `build` (test-bundel, `VITE_APP_ENV=test`) → `test` (lint + unit tests)
- `build-production` draait ernaast, alléén als `deploy_production` is aangevinkt bij een handmatige `workflow_dispatch`-run. Dit is een aparte build (niet hetzelfde artifact als `build`) omdat `VITE_APP_ENV` een build-time Vite-variabele is: één bundel kan niet tegelijk als `test` én `production` getagd zijn in Sentry/analytics.
- `build-production` draait ernaast, alléén als `deploy_production` is aangevinkt bij een handmatige `workflow_dispatch`-run **op een `release/*`-branch**. Dit is een aparte build (niet hetzelfde artifact als `build`) omdat `VITE_APP_ENV` een build-time Vite-variabele is: één bundel kan niet tegelijk als `test` én `production` getagd zijn in Sentry/analytics.
- Een losse `config`-job zet alle `env`-waarden (test én productie) om in job-outputs (zie hieronder waarom dat nodig is).
- `deploy-test` (bij `workflow_dispatch` of een push naar `master`) roept `deploy.yaml` aan met `artifact_name`/`environment`/`deploy_path` afkomstig van `needs.config.outputs.*` (dus indirect uit het `env:`-blok).
- `deploy-production` (alléén bij `workflow_dispatch` mét `deploy_production: true`) roept `deploy.yaml` op dezelfde manier aan, maar met de productie-artifact/omgeving/pad. Draait **nooit** automatisch bij een push naar `master`.
- `deploy-production` (alléén bij `workflow_dispatch` mét `deploy_production: true` **én een ref die met `refs/heads/release/` begint**, zoals de ASF-site; een dispatch vanaf `master` of een feature-branch doet voor productie niets) roept `deploy.yaml` op dezelfde manier aan, maar met de productie-artifact/omgeving/pad. Draait **nooit** automatisch bij een push naar `master`.
- `deploy.yaml` — download de artifact (naam/lokaal pad = `inputs.artifact_name`) en upload de inhoud via een `scp`-commando (met `sshpass` voor het wachtwoord) in een gewone shell-stap naar de opgegeven `deploy_path` op de host uit de meegegeven secrets. Deze workflow is omgeving-agnostisch (test/productie) en hoefde niet gewijzigd te worden.
### Waarom `sshpass`/`scp` in een shell-stap in plaats van de `appleboy/scp-action` Docker-action?
@@ -77,7 +77,7 @@ Merge een pull request naar `master` — de `deploy-test` job draait dan automat
Productie deployt **nooit** automatisch bij een push naar `master` — alleen via een expliciete, handmatige actie:
1. In Gitea, open de repository's **Actions** tab.
2. Selecteer de **Continuous Integration** workflow.
3. Klik **Run workflow**, kies de gewenste branch/ref (meestal `master`).
3. Klik **Run workflow**, kies een branch `release/<naam>` (bijv. `release/2026-11-20`, gemaakt vanaf `master`). Vanaf een andere branch (ook `master`) gebeurt er voor productie niets, ook niet met het vinkje.
4. Vink **`deploy_production`** aan voordat je de run start.
5. Dit triggert naast de gebruikelijke `build`/`test`/`deploy-test` ook `build-production` en `deploy-production`.