56 lines
1.6 KiB
YAML
56 lines
1.6 KiB
YAML
name: Build and Push Yavsc Production Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
production-deploy:
|
|
runs-on: ubuntu-26.04
|
|
steps:
|
|
# 1. Récupération du code
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v7
|
|
|
|
# 2. Configuration du moteur de Buildx pour les builds multi-plateformes
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v4
|
|
|
|
# 3. Connexion sécurisée à Docker Hub
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v4
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Set up .NET
|
|
uses: actions/setup-dotnet@v3
|
|
with:
|
|
dotnet-version: 10.0.x
|
|
- name: Workloads restore
|
|
run: dotnet workload restore
|
|
- name: Test
|
|
env:
|
|
TEST_FAILED: ""
|
|
run: make test || export TEST_FAILED=$?
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: my-artifact
|
|
path: test-reports/**/*
|
|
- name: Fail if tests failed
|
|
if: ${{ env.TEST_FAILED != '' && env.TEST_FAILED != '0' }}
|
|
run: exit $TEST_FAILED
|
|
|
|
# 4. Build et Push de l'image de production finale
|
|
- name: Build and push production image
|
|
uses: docker/build-push-action@v7
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.backend
|
|
push: true
|
|
tags: |
|
|
pazof/yavsc:latest
|
|
pazof/yavsc:${{ github.sha }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|