From da60f883f1a0f137942f3d8de52ac6e3f874b38a Mon Sep 17 00:00:00 2001 From: Mike McKiernan Date: Mon, 4 Mar 2024 13:23:42 -0500 Subject: [PATCH] CI from forks Signed-off-by: Mike McKiernan --- .github/workflows/docs-build.yaml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docs-build.yaml b/.github/workflows/docs-build.yaml index d43f1eb2c..44ec1e7eb 100644 --- a/.github/workflows/docs-build.yaml +++ b/.github/workflows/docs-build.yaml @@ -26,6 +26,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: read + packages: read outputs: changed: ${{ steps.change.outputs.changed }} image: ${{ steps.change.outputs.image }} @@ -40,14 +41,24 @@ jobs: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Manifest + shell: bash + run: | + docker manifest inspect "${REGISTRY}/${IMAGE_NAME,,}:${TAG}" - name: Detect change id: change + shell: bash run: | export COMMIT_SHORT_SHA="${GITHUB_SHA:0:8}" - if ! docker manifest inspect "${REGISTRY}/${IMAGE_NAME}:${TAG}" 2>&1 > /dev/null ; then export NEEDS_IMAGE=true ; fi + docker manifest inspect "${REGISTRY}/${IMAGE_NAME,,}:${TAG}" + if ! docker manifest inspect "${REGISTRY}/${IMAGE_NAME,,}:${TAG}" 2>&1 > /dev/null ; then + echo "image not found...${REGISTRY}/${IMAGE_NAME,,}:${TAG}" + export NEEDS_IMAGE=true + fi def_branch=$(gh api "repos/${GITHUB_REPOSITORY}" -q '.default_branch') git fetch origin "${def_branch}" files=$(git diff --name-only "${GITHUB_SHA}" "origin/${def_branch}" | tr '\n' ' ') + echo "${files}" if echo "${files}" | grep -q "deps/\|Dockerfile\|repo.toml"; then export NEEDS_IMAGE=true ; fi if [[ "${NEEDS_IMAGE}" ]]; then echo "changed=true" >> "$GITHUB_OUTPUT" @@ -60,7 +71,6 @@ jobs: echo "changed=false" >> "$GITHUB_OUTPUT" echo "image=${REGISTRY}/${IMAGE_NAME,,}:${TAG}" >> "$GITHUB_OUTPUT" fi - shell: bash build-and-push-image: needs: dockerfile-changed