From 446eece2d57a1251b52a5e66c6b36eaa41a96c80 Mon Sep 17 00:00:00 2001 From: Todd Ekenstam Date: Thu, 28 Sep 2023 12:49:06 -0700 Subject: [PATCH] Updates to docker push action Signed-off-by: Todd Ekenstam --- .github/workflows/push.yaml | 95 +++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/.github/workflows/push.yaml b/.github/workflows/push.yaml index 59f1f17..019f119 100644 --- a/.github/workflows/push.yaml +++ b/.github/workflows/push.yaml @@ -2,54 +2,59 @@ name: push on: push: - branches: [ master ] + branches: + - 'master' tags: - - '*' + - 'v*' jobs: - push: - name: push + docker: if: github.repository_owner == 'keikoproj' runs-on: ubuntu-latest steps: - - - name: Check out code into the Go module directory - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v3 - with: - install: true - version: latest - - - name: Set up QEMU - id: qemu - uses: docker/setup-qemu-action@v3 - with: - platforms: linux/amd64,linux/arm64 - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Docker meta - id: docker_meta - uses: docker/metadata-action@v5 - with: - images: ${{ github.repository_owner }}/cluster-validator - tags: | - type=ref,event=branch - type=ref,event=pr - type=semver,pattern={{version}} - - - name: Build and push - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ steps.docker_meta.outputs.tags }} + - + name: Check out code + uses: actions/checkout@v4 + + - + name: Set up QEMU + id: qemu + uses: docker/setup-qemu-action@v3 + + - + name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v3 + with: + install: true + version: latest + + - + name: Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ github.repository_owner }}/cluster-validator + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + + - + name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - + name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}