From ef3ba1aeba16752d2a07f1ec7ea34ef03a1c50e5 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Mon, 6 May 2024 22:35:57 +0200 Subject: [PATCH] clean up docker builds in workflow --- .github/workflows/build-container.yml | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index aa82d52..a8711fb 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -3,6 +3,8 @@ on: push: branches: - master + - staging + - prod pull_request: branches: - master @@ -19,13 +21,13 @@ jobs: username: ${{ secrets.DOCKER_HUB_USER }} password: ${{ secrets.DOCKER_HUB_TOKEN }} - name: Build test image + id: docker-build-test uses: docker/build-push-action@v5 with: - tags: ${{ github.repository }}:test target: test push: false - name: Run Perl tests - run: docker run -i ${{ github.repository }}:test + run: docker run -i ${{ steps.docker-build-test.outputs.imageid }} - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -34,19 +36,10 @@ jobs: flavor: | latest=false tags: | - type=sha,format=long + type=sha,format=long,priority=1000 type=ref,event=branch type=ref,event=pr type=raw,value=latest,enable={{is_default_branch}} - - name: Docker meta (sha) - id: docker-sha-tag - uses: docker/metadata-action@v5 - with: - images: ${{ github.repository }} - flavor: | - latest=false - tags: | - type=sha,format=long - name: Build and push uses: docker/build-push-action@v5 with: @@ -54,4 +47,4 @@ jobs: tags: ${{ steps.meta.outputs.tags }} annotations: ${{ steps.meta.outputs.annotations }} - if: contains( fromJSON(steps.meta.outputs.json).tags, "${{ github.repository }}:latest") - run: echo 'need update to ${{ steps.docker-sha-tag.outputs.tags }}' + run: echo 'need update to ${{ fromJSON(steps.meta.outputs.json).tags[0] }}'