From 7d53e59097ec46669ecaa274daeaf777feba79c4 Mon Sep 17 00:00:00 2001 From: Yoriiis <2563298+yoriiis@users.noreply.github.com> Date: Wed, 28 Jan 2026 15:23:33 +0100 Subject: [PATCH] Publish Docker images with version tags --- .github/workflows/build_docker_images.yaml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_docker_images.yaml b/.github/workflows/build_docker_images.yaml index 120ee5d..7a20811 100644 --- a/.github/workflows/build_docker_images.yaml +++ b/.github/workflows/build_docker_images.yaml @@ -40,7 +40,20 @@ jobs: password: ${{ secrets.ACCESS_TOKEN }} - - name: Build images + name: Build and push images run: | - docker build . --tag ghcr.io/${{ github.repository_owner }}/monorepo-split:latest --build-arg commitHash=${{ github.sha }} - docker push ghcr.io/${{ github.repository_owner }}/monorepo-split:latest + IMAGE_NAME="ghcr.io/${{ github.repository_owner }}/monorepo-split" + + # Build image + docker build . --tag ${IMAGE_NAME}:latest --build-arg commitHash=${{ github.sha }} + + # If triggered by a tag, also tag the image with the version + if [[ "${{ github.ref_type }}" == "tag" ]]; then + docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:${{ github.ref_name }} + docker push ${IMAGE_NAME}:${{ github.ref_name }} + echo "✅ Pushed ${IMAGE_NAME}:${{ github.ref_name }}" + fi + + # Always push latest + docker push ${IMAGE_NAME}:latest + echo "✅ Pushed ${IMAGE_NAME}:latest"