From 2d7c8277d585032b97c6be19cd958becbb8b004c Mon Sep 17 00:00:00 2001 From: Peter Balogh Date: Thu, 17 Sep 2020 11:44:12 +0200 Subject: [PATCH] update push-action to v2 Signed-off-by: Peter Balogh --- .github/workflows/docker.yaml | 47 ++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 9b2b77c6..c15f4a55 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -11,16 +11,45 @@ jobs: name: Docker runs-on: ubuntu-latest steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 - name: Checkout code uses: actions/checkout@v2 - - name: Build banzai-cli - uses: docker/build-push-action@v1 + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.ref }} + restore-keys: | + ${{ runner.os }}-buildx- + + - name: Determine tag or commit + uses: haya14busa/action-cond@v1 + id: refortag + with: + cond: ${{ startsWith(github.ref, 'refs/tags/') }} + if_true: ${{ github.ref }} + if_false: latest + - name: Determine image tag + id: imagetag + run: echo "::set-output name=value::${TAG_OR_BRANCH##*/}" + env: + TAG_OR_BRANCH: ${{ steps.refortag.outputs.value }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 with: - username: ${{ github.actor }} - password: ${{ secrets.CR_PAT }} registry: ghcr.io - repository: banzaicloud/banzai-cli - dockerfile: Dockerfile - tag_with_ref: true - add_git_labels: true - tags: latest + username: ${{ github.repository_owner }} + password: ${{ secrets.CR_PAT }} + + - name: Build banzai-cli + uses: docker/build-push-action@v2 + with: + tags: ghcr.io/banzaicloud/banzai-cli:${{ steps.imagetag.outputs.value }} + file: Dockerfile + push: true + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache