Skip to content

Commit 1cf21e6

Browse files
committed
improve Docker CI/CD to exit if an image already exists for the current version
1 parent 1e433ee commit 1cf21e6

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/docker.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: Docker
22

33
on:
4-
# push:
5-
# tags:
6-
# - 'v[0-9]+.[0-9]+.[0-9]+'
74
workflow_dispatch:
85

96
jobs:
@@ -21,6 +18,13 @@ jobs:
2118
echo "VERSION=$VERSION" >> $GITHUB_ENV
2219
echo "version=$VERSION" >> $GITHUB_OUTPUT
2320
21+
- name: Check there is no existing image with the same version
22+
run: |
23+
if docker manifest inspect ghcr.io/gyulyvgc/sniffnet:${{ env.VERSION }}; then
24+
echo "Image with version ${{ env.VERSION }} already exists"
25+
exit 1
26+
fi
27+
2428
- name: Set up QEMU
2529
uses: docker/setup-qemu-action@v3
2630

@@ -43,4 +47,3 @@ jobs:
4347
tags: |
4448
ghcr.io/gyulyvgc/sniffnet:latest
4549
ghcr.io/gyulyvgc/sniffnet:${{ env.VERSION }}
46-
# ghcr.io/gyulyvgc/sniffnet:${{ github.ref_name }}

0 commit comments

Comments
 (0)