chore: add CD
This commit is contained in:
@@ -60,3 +60,56 @@ jobs:
|
|||||||
name: backend-binary
|
name: backend-binary
|
||||||
path: backend/gestion/gestion
|
path: backend/gestion/gestion
|
||||||
retention-days: 7
|
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
|
||||||
|
|||||||
@@ -5,10 +5,12 @@ on:
|
|||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
paths:
|
||||||
- "frontend-prep/**"
|
- "frontend-prep/**"
|
||||||
|
- "docker/frontend/**"
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
paths:
|
paths:
|
||||||
- "frontend-prep/**"
|
- "frontend-prep/**"
|
||||||
|
- "docker/frontend/**"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint-typecheck:
|
lint-typecheck:
|
||||||
@@ -68,3 +70,46 @@ jobs:
|
|||||||
name: frontend-web-dist
|
name: frontend-web-dist
|
||||||
path: frontend-prep/dist
|
path: frontend-prep/dist
|
||||||
retention-days: 7
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user