chore: update ci

This commit is contained in:
2026-06-18 22:43:42 +02:00
parent af9092fa34
commit 5a77bacb04
4 changed files with 77 additions and 221 deletions
+11 -44
View File
@@ -11,10 +11,8 @@ on:
- "backend/**/**"
jobs:
lint:
name: Static Analysis (golangci-lint + gosec)
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
@@ -36,31 +34,12 @@ jobs:
working-directory: backend/gestion
args: --timeout=5m
- name: Install gosec
run: go install github.com/securego/gosec/v2/cmd/gosec@latest
- name: Run Gosec Security Scanner
- name: Install & run gosec
working-directory: backend/gestion
run: gosec ./...
continue-on-error: true
build:
name: Build
needs: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.24.4"
cache-dependency-path: backend/gestion/go.sum
- name: Download dependencies
working-directory: backend/gestion
run: go mod download
run: |
go install github.com/securego/gosec/v2/cmd/gosec@latest
gosec ./...
- name: Build
working-directory: backend/gestion
@@ -73,27 +52,19 @@ jobs:
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' || github.ref == 'refs/heads/pre-prod')
steps:
- uses: actions/checkout@v4
- name: Login to Docker Hub
if: github.event_name == 'push'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
if: github.event_name == 'push'
uses: docker/setup-buildx-action@v3
- name: Build & push backend (runtime)
if: github.event_name == 'push'
uses: docker/build-push-action@v6
with:
context: .
@@ -103,6 +74,7 @@ jobs:
tags: xor1234/backend-mln:${{ github.ref == 'refs/heads/main' && 'latest' || 'pre-prod' }}
- name: Build & push WAF
if: github.event_name == 'push'
uses: docker/build-push-action@v6
with:
context: .
@@ -111,13 +83,8 @@ jobs:
push: true
tags: xor1234/backend-mln:${{ github.ref == 'refs/heads/main' && 'waf' || 'waf-pre-prod' }}
deploy:
name: SSH Deploy
needs: docker
runs-on: ubuntu-latest
steps:
- name: SSH deploy
- name: SSH Deploy
if: github.event_name == 'push'
uses: appleboy/ssh-action@v1
with:
host: ${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && secrets.SERVER_HOST_PROD || secrets.SERVER_HOST_PRE_PROD }}