batchCooking/.github/workflows/release.yml
Nicolas c2cc773c7b Fusionner web+api en une image, séparer la CI, ajouter la release
- express-tools: ExpressServer.serveStaticFrontend() sert le build du
  frontend (assets + fallback SPA), monté après les routes API et avant
  le 404 JSON. Opt-in via FRONTEND_DIST_DIR (uniquement défini dans
  l'image Docker) — le dev natif (dev:api/dev:web) est inchangé.
- apps/api/Dockerfile: build aussi apps/web, embarque son dist dans le
  runtime ; corrige au passage l'oubli de packages/date-tools. Supprime
  apps/web/Dockerfile et nginx.conf (plus de conteneur nginx séparé).
- docker-compose.yml: un seul service "app" (postgres + app), un seul
  port APP_PORT, plus de WEB_PORT/CORS_ORIGIN à coordonner entre deux
  origines. Garde `build:` (pas de registre — Portainer build depuis le
  repo Git).
- ci.yml: éclate le job unique lint-and-test+e2e en 4 jobs indépendants
  (lint/test/build/e2e), sans chaînage, déclenchés sur chaque push
  (toute branche) + PR vers main.
- release.yml (nouveau): sur tag vX.Y.Z, sanity-build de l'image Docker,
  GitHub Release avec changelog auto-généré, puis notification best-effort
  du webhook Portainer (secret PORTAINER_WEBHOOK_URL).
- README: documente le conteneur unique et le pipeline de release.
2026-08-17 23:11:26 +02:00

55 lines
1.9 KiB
YAML

name: Release
# No image registry involved: Portainer is wired to this repo's Git remote
# and builds/redeploys apps/api/Dockerfile itself. This workflow sanity-checks
# that the image actually builds at the tagged commit, publishes a GitHub
# Release, then (best-effort) pings Portainer's deploy webhook so it doesn't
# have to wait for its own polling interval.
on:
push:
tags: ["v*.*.*"]
permissions:
contents: write
jobs:
sanity-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Build only, no push, no registry — just confirms Portainer will be
# able to build this same Dockerfile successfully at this tag before
# anyone points it at this ref.
- run: docker build -f apps/api/Dockerfile .
github-release:
runs-on: ubuntu-latest
needs: sanity-build
steps:
- uses: actions/checkout@v4
- uses: softprops/action-gh-release@v2
with:
# Auto-generated from merged PRs since the previous tag — no
# changelog tooling to maintain, consistent with there being no
# versioning tooling elsewhere in the repo yet.
generate_release_notes: true
notify-portainer:
runs-on: ubuntu-latest
needs: github-release
steps:
- name: Trigger Portainer redeploy
# Best-effort: does nothing (and doesn't fail the workflow) until
# the PORTAINER_WEBHOOK_URL repo secret is set — grab that URL from
# the stack's webhook setting in Portainer and add it as a secret
# named PORTAINER_WEBHOOK_URL (see README).
env:
PORTAINER_WEBHOOK_URL: ${{ secrets.PORTAINER_WEBHOOK_URL }}
run: |
if [ -z "$PORTAINER_WEBHOOK_URL" ]; then
echo "PORTAINER_WEBHOOK_URL not set — skipping, Portainer will pick this up on its next poll."
exit 0
fi
curl -fsS -X POST "$PORTAINER_WEBHOOK_URL"