chore: add CD

This commit is contained in:
2026-05-02 18:20:57 +02:00
parent 99ce3e4bb3
commit e93ad8c9f0
2 changed files with 98 additions and 0 deletions
+53
View File
@@ -60,3 +60,56 @@ jobs:
name: backend-binary
path: backend/gestion/gestion
retention-days: 7
docker:
name: Docker Build & Push
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build & push backend (runtime)
uses: docker/build-push-action@v6
with:
context: .
file: docker/backend/Dockerfile
target: runtime
push: true
tags: xor1234/backend-mln:latest
- name: Build & push WAF
uses: docker/build-push-action@v6
with:
context: .
file: docker/backend/Dockerfile
target: waf
push: true
tags: xor1234/backend-mln:waf
deploy:
name: SSH Deploy
needs: docker
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: SSH deploy
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
docker compose -f ${{ secrets.COMPOSE_PATH }} pull backend waf
docker compose -f ${{ secrets.COMPOSE_PATH }} up -d --no-deps backend waf
+45
View File
@@ -5,10 +5,12 @@ on:
branches: [main]
paths:
- "frontend-prep/**"
- "docker/frontend/**"
pull_request:
branches: [main]
paths:
- "frontend-prep/**"
- "docker/frontend/**"
jobs:
lint-typecheck:
@@ -68,3 +70,46 @@ jobs:
name: frontend-web-dist
path: frontend-prep/dist
retention-days: 7
docker:
name: Docker Build & Push
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build & push frontend
uses: docker/build-push-action@v6
with:
context: .
file: docker/frontend/Dockerfile
push: true
tags: xor1234/frontend-mln:latest
deploy:
name: SSH Deploy
needs: docker
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
steps:
- name: SSH deploy
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.SERVER_HOST_PROD }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY_PROD }}
script: |
docker compose -f ${{ secrets.COMPOSE_PATH }} pull frontend
docker compose -f ${{ secrets.COMPOSE_PATH }} up -d --no-deps frontend