From 7b90d70fc83ab7444581ff3751353e7e9ea97e42 Mon Sep 17 00:00:00 2001 From: John Boyes Date: Wed, 17 Jan 2024 13:38:36 +0000 Subject: [PATCH] Check that Docker latest tag is correct --- .github/workflows/check_docker_latest.yml | 28 +++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 .github/workflows/check_docker_latest.yml diff --git a/.github/workflows/check_docker_latest.yml b/.github/workflows/check_docker_latest.yml new file mode 100644 index 00000000..2b48274f --- /dev/null +++ b/.github/workflows/check_docker_latest.yml @@ -0,0 +1,28 @@ +--- +name: Check newly released Docker image with current semantic version tag is also tagged with latest +on: # yamllint disable-line rule:truthy + push + +jobs: + + check_latest_tag: + runs-on: ubuntu-22.04 + env: + repo: agilepathway/pull-request-label-checker + image_ver: v1.6.13 + steps: + + - name: Check Docker image for new release is tagged latest + id: check_docker_image_tagged_latest + # yamllint disable rule:line-length + run: | + docker pull ${{env.repo}}:${{ env.image_ver }} + echo "IS_LATEST_TAGGED_CORRECTLY=$(docker image inspect ${{env.repo}}:${{ env.image_ver }} | jq -r '.[] | (.RepoTags) | any( . == "${{env.repo}}:latest") ')" >> "$GITHUB_OUTPUT" + # yamllint enable rule:line-length + + - name: Fail if latest is not tagged correctly + if: ${{ steps.check_docker_image_tagged_latest.outputs.IS_LATEST_TAGGED_CORRECTLY == 'false' }} + uses: actions/github-script@v7 + with: + script: | + core.setFailed('The newly released Docker image ${{ env.image_ver }} is not tagged latest. ')