feat: ajouter un workflow GitHub Actions pour le déploiement en production

This commit is contained in:
Puechberty Arthur
2026-05-05 20:07:44 +02:00
parent 5596964cfe
commit 3072935dde
+45
View File
@@ -0,0 +1,45 @@
name: Deploy Production
on:
push:
branches: [main]
concurrency:
group: production-deploy
cancel-in-progress: true
jobs:
deploy:
runs-on: self-hosted
steps:
- name: Deploy portfolio Production
shell: bash
run: |
set -euo pipefail
echo "============================"
echo " Starting deployment"
echo "============================"
APP_DIR="/srv/apps/portfolio"
cd "$APP_DIR"
echo "Fetching latest code..."
git fetch origin main
echo "Resetting local state..."
git reset --hard origin/main
echo "Cleaning untracked files (keeping .env)"
git clean -fd -e .env
echo "Pulling/building containers..."
docker compose pull || true
docker compose up -d --build --remove-orphans
echo "Cleaning unused Docker images..."
docker image prune -f
echo "Deployment finished successfully"