5959 with :
6060 since_last_remote_commit : " true"
6161 files : .github/Dockerfiles/*
62+ - name : Set tag
63+ run : |
64+ TAG=$(sed 's/\./:/' <(echo ${{ matrix.Dockerfile }}))
65+ DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]')
66+ echo DOCKER_TAG=$DOCKER_TAG >> $GITHUB_ENV
67+ docker manifest inspect $DOCKER_TAG >/dev/null
68+ echo "::set-output name=not_yet_exists::$?"
6269 - name : Set up Docker Buildx
63706471 if : contains(steps.changed-files-base.outputs.all_changed_files, matrix.Dockerfile) || contains(steps.changed-files.outputs.all_changed_files, matrix.Dockerfile)
6976 username : ${{ github.actor }}
7077 password : ${{ secrets.GITHUB_TOKEN }}
7178 if : contains(steps.changed-files-base.outputs.all_changed_files, matrix.Dockerfile) || contains(steps.changed-files.outputs.all_changed_files, matrix.Dockerfile)
72- - name : Set tag
73- run : |
74- TAG=$(sed 's/\./:/' <(echo ${{ matrix.Dockerfile }}))
75- echo DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
76- if : contains(steps.changed-files-base.outputs.all_changed_files, matrix.Dockerfile) || contains(steps.changed-files.outputs.all_changed_files, matrix.Dockerfile)
7779 - name : Build and push Docker image
78807981 with :
@@ -149,7 +151,10 @@ jobs:
149151 - name : Set tag
150152 run : |
151153 TAG=$(sed 's/\./:/' <(echo ${{ matrix.Dockerfile }}))
152- echo DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
154+ DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]')
155+ echo DOCKER_TAG=$DOCKER_TAG >> $GITHUB_ENV
156+ docker manifest inspect $DOCKER_TAG >/dev/null
157+ echo "::set-output name=not_yet_exists::$?"
153158 if : contains(steps.changed-files-base.outputs.all_changed_files, matrix.Dockerfile) || contains(steps.changed-files.outputs.all_changed_files, matrix.Dockerfile)
154159 - name : Prep Dockerfiles for forked repository
155160 if : github.repository_owner != 'FCP-INDI' && contains(steps.changed-files-base.outputs.all_changed_files, matrix.Dockerfile) || contains(steps.changed-files.outputs.all_changed_files, matrix.Dockerfile)
@@ -216,36 +221,39 @@ jobs:
216221 since_last_remote_commit : " true"
217222 files_from_source_file : |
218223 .github/stage_requirements/${{ matrix.variant }}.txt
224+ - name : Set tag
225+ run : |
226+ TAG="stage-base:${{ matrix.variant }}-$(cat version)"
227+ DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]')
228+ echo DOCKER_TAG=$DOCKER_TAG >> $GITHUB_ENV
229+ docker manifest inspect $DOCKER_TAG >/dev/null
230+ echo "::set-output name=not_yet_exists::$?"
231+ id : docker_tag
219232 - name : Clear up some space on runner
220- if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
233+ if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
221234 run : |
222235 sudo rm -rf /usr/share/dotnet
223236 sudo rm -rf /opt/ghc
224237 sudo rm -rf "/usr/local/share/boost"
225238 sudo rm -rf "$AGENT_TOOLSDIRECTORY"
226239 - name : Set up Docker Buildx
227240228- if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
241+ if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
229242 - name : Log in to GitHub Container Registry
230243 uses : docker/login-action@v1
231244 with :
232245 registry : ghcr.io
233246 username : ${{ github.actor }}
234247 password : ${{ secrets.GITHUB_TOKEN }}
235- if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
236- - name : Set tag
237- run : |
238- TAG="stage-base:${{ matrix.variant }}-$(cat version)"
239- echo DOCKER_TAG=$(echo "ghcr.io/${{ github.repository }}/$TAG" | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
240- if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
248+ if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
241249 - name : Prep Dockerfiles for forked repository
242- if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
250+ if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
243251 run : |
244252 .github/scripts/local_ghcr .github/Dockerfiles/base-${{ matrix.variant }}.Dockerfile ${{ github.repository_owner }} $DOCKER_TAG
245253 cat .github/Dockerfiles/base-${{ matrix.variant }}.Dockerfile
246254 - name : See Dockerfile
247255 run : cat .github/Dockerfiles/base-${{ matrix.variant }}.Dockerfile
248- if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
256+ if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
249257 - name : Build and push base image
250258251259 with :
@@ -256,7 +264,7 @@ jobs:
256264 ${{ env.DOCKER_TAG }}
257265 cache-from : type=gha
258266 cache-to : type=gha,mode=max
259- if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true'
267+ if : steps.changed-files-base.outputs.any_changed == 'true' || steps.changed-files.outputs.any_changed == 'true' || steps.docker_tag.not_yet_exists == 1
260268
261269 trigger-next-workflow :
262270 needs : build-base
0 commit comments