Skip to content

Commit c7eb646

Browse files
committed
pull out reusable tag check action
1 parent 323134a commit c7eb646

File tree

2 files changed

+34
-24
lines changed

2 files changed

+34
-24
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'Check Docker Tag Exists'
2+
description: 'Check if a Docker tag exists on DockerHub to prevent overwrites'
3+
inputs:
4+
image_name:
5+
description: 'Docker image name (e.g. airbyte/source-declarative-manifest)'
6+
required: true
7+
tag:
8+
description: 'Docker tag to check'
9+
required: true
10+
runs:
11+
using: "composite"
12+
steps:
13+
- name: "Check for existing tag (${{ inputs.image_name }}:${{ inputs.tag }})"
14+
shell: bash
15+
run: |
16+
tag="${{ inputs.image_name }}:${{ inputs.tag }}"
17+
if [ -z "$tag" ]; then
18+
echo "Error: tag is not set."
19+
exit 1
20+
fi
21+
echo "Checking if tag '$tag' exists on DockerHub..."
22+
if DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect "$tag" > /dev/null 2>&1; then
23+
echo "The tag '$tag' already exists on DockerHub. Skipping publish to prevent overwrite."
24+
exit 1
25+
fi
26+
echo "No existing tag '$tag' found. Proceeding with publish."

.github/workflows/publish.yml

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -209,18 +209,10 @@ jobs:
209209

210210
- name: "Check for existing tag (version: ${{ env.VERSION || 'none' }} )"
211211
if: env.VERSION != ''
212-
run: |
213-
tag="airbyte/source-declarative-manifest:${{ env.VERSION }}"
214-
if [ -z "$tag" ]; then
215-
echo "Error: VERSION is not set. Ensure the tag follows the format 'refs/tags/vX.Y.Z'."
216-
exit 1
217-
fi
218-
echo "Checking if tag '$tag' exists on DockerHub..."
219-
if DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect "$tag" > /dev/null 2>&1; then
220-
echo "The tag '$tag' already exists on DockerHub. Skipping publish to prevent overwrite."
221-
exit 1
222-
fi
223-
echo "No existing tag '$tag' found. Proceeding with publish."
212+
uses: ./.github/actions/check-docker-tag
213+
with:
214+
image_name: airbyte/source-declarative-manifest
215+
tag: ${{ env.VERSION }}
224216

225217
- name: "Build and push (sha tag: '${{ github.sha }}')"
226218
# Only run if the version is not set
@@ -298,18 +290,10 @@ jobs:
298290

299291
- name: "Check for existing tag (version: ${{ env.VERSION || 'none' }} )"
300292
if: env.VERSION != ''
301-
run: |
302-
tag="airbyte/manifest-server:${{ env.VERSION }}"
303-
if [ -z "$tag" ]; then
304-
echo "Error: VERSION is not set. Ensure the tag follows the format 'refs/tags/vX.Y.Z'."
305-
exit 1
306-
fi
307-
echo "Checking if tag '$tag' exists on DockerHub..."
308-
if DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect "$tag" > /dev/null 2>&1; then
309-
echo "The tag '$tag' already exists on DockerHub. Skipping publish to prevent overwrite."
310-
exit 1
311-
fi
312-
echo "No existing tag '$tag' found. Proceeding with publish."
293+
uses: ./.github/actions/check-docker-tag
294+
with:
295+
image_name: airbyte/manifest-server
296+
tag: ${{ env.VERSION }}
313297

314298
- name: "Build and push (sha tag: '${{ github.sha }}')"
315299
# Only run if the version is not set

0 commit comments

Comments
 (0)