Nicolas Cantu 7d17215727
Some checks are pending
publish-images / docker-build-and-push (push) Waiting to run
ci: images registry en minuscules + compose override registry
2025-09-11 16:56:06 +02:00

72 lines
2.1 KiB
YAML

name: publish-images
on:
push:
branches: [ '**' ]
tags: [ '*' ]
env:
REGISTRY: git.4nkweb.com
IMAGE_OWNER: 4nk
IMAGE_REPO: 4nk-ia-back
jobs:
docker-build-and-push:
runs-on: debian-runner
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.USER }}
password: ${{ secrets.TOKEN }}
- name: Compute tags
id: meta
run: |
set -euo pipefail
# Déterminer si l'on est sur un tag exact
if TAG_NAME=$(git describe --tags --exact-match 2>/dev/null); then
VERSION_TAG="$TAG_NAME"
else
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
if [[ "$BRANCH_NAME" == "HEAD" ]]; then
SHORT_SHA=$(git rev-parse --short=8 HEAD)
VERSION_TAG="sha-${SHORT_SHA}"
else
VERSION_TAG=$(echo "$BRANCH_NAME" | tr '/' '-')
fi
fi
echo "version=${VERSION_TAG}" >> "$GITHUB_OUTPUT"
- name: Build & Push host-api
uses: docker/build-push-action@v6
with:
context: ./docker/host-api
file: ./docker/host-api/Dockerfile
push: true
platforms: linux/amd64
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_REPO }}/host-api:${{ steps.meta.outputs.version }}
${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_REPO }}/host-api:latest
- name: Build & Push worker
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/worker/Dockerfile
push: true
platforms: linux/amd64
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_REPO }}/worker:${{ steps.meta.outputs.version }}
${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_REPO }}/worker:latest