Files
projet_gestion_commande/.github/workflows/frontend-web-build.yml
T
2026-09-08 17:53:21 +02:00

65 lines
2.1 KiB
YAML

name: Frontend Web - Build & Lint
on:
push:
branches: [main, pre-prod]
paths:
- "frontend-prep/**"
- "docker-pre-prod/frontend/**"
pull_request:
branches: [main, pre-prod]
paths:
- "frontend-prep/**"
- "docker-pre-prod/frontend/**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: frontend-prep/package-lock.json
- name: Install dependencies
working-directory: frontend-prep
run: npm ci
- name: Typecheck & lint
working-directory: frontend-prep
run: |
npx tsc -b --noEmit
npm run lint
- name: Build
working-directory: frontend-prep
env:
VITE_TOMTOM_API_KEY: ${{ secrets.VITE_TOMTOM_API_KEY }}
run: npm run build
- name: Login to Docker Hub
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Docker Buildx
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: docker/setup-buildx-action@v3
- name: Build & push frontend
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: docker/build-push-action@v6
with:
context: .
file: docker-prod/frontend/Dockerfile
push: true
tags: xor1234/frontend-mln:${{ (github.ref == 'refs/heads/main' || github.base_ref == 'main') && 'latest' || 'pre-prod' }}
build-args: |
VITE_TOMTOM_API_KEY=${{ secrets.VITE_TOMTOM_API_KEY }}