Skip to content

[backend] refactor: create logger and error packages #3

[backend] refactor: create logger and error packages

[backend] refactor: create logger and error packages #3

name: Build portal-api
on:
workflow_dispatch:
push:
branches:
- "main"
- "development"
paths:
- "apps/portal-api/**"
tags:
- "v*"
pull_request:
branches:
- "main"
- "development"
paths:
- "apps/portal-api/**"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-portal-api:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
packages: write
strategy:
fail-fast: true
matrix:
include:
- image: portal-api
dockerfile: apps/portal-api/Dockerfile
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3 #est-ce qu'on a besoin de le garder lui ?
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: yarn install
- run: npx nx build portal-api
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta deps
id: meta
uses: docker/metadata-action@v5
with:
images: filigran/${{ matrix.image }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push portal image
uses: docker/build-push-action@v6
with:
context: .
file: ${{ matrix.dockerfile }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
APP_VERSION=0.0.0-e2e
cache-from: |
type=registry,ref=filigran/${{ matrix.image }}:main
type=registry,ref=filigran/${{ matrix.image }}:development
type=registry,ref=filigran/${{ matrix.image }}:cache-${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}
cache-to: type=registry,ref=filigran/${{ matrix.image }}:cache-${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }},mode=max