From f1081cb721498a3328c2cce4fb3e7e26ebf8338a Mon Sep 17 00:00:00 2001 From: "Gerber, Mike" Date: Thu, 9 Feb 2023 18:55:30 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20github:=20Reuse=20subimage=20wor?= =?UTF-8?q?kflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-subimage.yml | 16 ++++++++----- .github/workflows/build.yml | 35 +++++++++++----------------- 2 files changed, 23 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build-subimage.yml b/.github/workflows/build-subimage.yml index b7bfa07..98e938b 100644 --- a/.github/workflows/build-subimage.yml +++ b/.github/workflows/build-subimage.yml @@ -7,10 +7,6 @@ on: tags: required: true type: string - cache-from: - required: false - type: string - default: secrets: DOCKERHUB_USERNAME: required: true @@ -30,6 +26,14 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + quratorspk/ocrd-galley-${{ inputs.subimage }} + tags: ${{ inputs.tags }} - name: Login to Docker Hub uses: docker/login-action@v2 @@ -44,7 +48,7 @@ jobs: file: Dockerfile-${{ inputs.subimage }} build-args: DRONE_COMMIT=${{ github.sha }} - tags: ${{ inputs.tags }} + tags: ${{ steps.meta.outputs.tags }} push: true - cache-from: ${{ inputs.cache-from }} + cache-from: quratorspk/ocrd-galley-${{ inputs.subimage }}:${{ github.sha }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 653eead..ebe9df0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,8 @@ jobs: uses: ./.github/workflows/build-subimage.yml with: subimage: ${{ matrix.subimage }} - tags: quratorspk/ocrd-galley-${{ matrix.subimage }}:${{ github.sha }} + tags: | + type=sha,format=long secrets: inherit build-rest: @@ -29,7 +30,8 @@ jobs: uses: ./.github/workflows/build-subimage.yml with: subimage: ${{ matrix.subimage }} - tags: quratorspk/ocrd-galley-${{ matrix.subimage }}:${{ github.sha }} + tags: | + type=sha,format=long secrets: inherit @@ -58,27 +60,16 @@ jobs: # tags. We do this by building again, but using the formerly built images to # cache from. - tag: + push-with-tags: needs: test - runs-on: ubuntu-latest strategy: matrix: subimage: ["core", "dinglehopper"] - # TODO have one list, not multiple - steps: - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - quratorspk/ocrd-galley-${{ matrix.subimage }} - tags: | - type=ref,event=branch - - - name: Push with tags (from cache) - uses: ./.github/workflows/build-subimage.yml - with: - subimage: ${{ matrix.subimage }} - cache-from: quratorspk/ocrd-galley-${{ matrix.subimage }}:${{ github.sha }} - tags: ${{ steps.meta.outputs.tags }} + uses: ./.github/workflows/build-subimage.yml + with: + subimage: ${{ matrix.subimage }} + tags: | + type=sha,format=long + type=ref,event=tag + use-cache: true + secrets: inherit