improve Docker CI/CD to exit if an image already exists for the current version

This commit is contained in:
GyulyVGC
2025-08-03 17:39:07 +02:00
parent 1e433ee1b9
commit 1cf21e6fc2

View File

@@ -1,9 +1,6 @@
name: Docker
on:
# push:
# tags:
# - 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
@@ -21,6 +18,13 @@ jobs:
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Check there is no existing image with the same version
run: |
if docker manifest inspect ghcr.io/gyulyvgc/sniffnet:${{ env.VERSION }}; then
echo "Image with version ${{ env.VERSION }} already exists"
exit 1
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
@@ -43,4 +47,3 @@ jobs:
tags: |
ghcr.io/gyulyvgc/sniffnet:latest
ghcr.io/gyulyvgc/sniffnet:${{ env.VERSION }}
# ghcr.io/gyulyvgc/sniffnet:${{ github.ref_name }}