From 0313ce86a5a729cb38c7f019a7049e0e90a606fe Mon Sep 17 00:00:00 2001 From: Su Nguyen T Date: Mon, 4 Dec 2023 19:26:53 +0700 Subject: [PATCH] Try to cache local of github hub --- .github/workflows/deploy.yml | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e97679f..370d419 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -41,9 +41,21 @@ jobs: with: ref: ${{ github.event.workflow_run.head_branch || github.ref }} + - name: Set environment variables + run: | + echo "DOCKER_IMAGE_TAG=$DOCKER_REGISTRY/$DOCKER_IMAGE:$BRANCH_TAG" >> $GITHUB_ENV + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-multi-buildx + - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -51,10 +63,6 @@ jobs: username: ${{ env.DOCKER_USERNAME }} password: ${{ env.DOCKER_TOKEN }} - - name: Set environment variables - run: | - echo "DOCKER_IMAGE_TAG=$DOCKER_REGISTRY/$DOCKER_IMAGE:$BRANCH_TAG" >> $GITHUB_ENV - - name: Prepare Docker image run: | bin/docker-prepare @@ -65,8 +73,13 @@ jobs: context: . push: true tags: ${{ env.DOCKER_IMAGE_TAG }} - cache-from: type=gha - cache-to: type=gha,mode=max + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new + + - name: Move cache to correct location + run: | + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache - name: Set HEROKU_APP run: |