From d586f7c557a37b40507f0b418a27e86f0cf6658e Mon Sep 17 00:00:00 2001 From: Ted Spinks Date: Tue, 21 Feb 2023 20:08:40 -0500 Subject: [PATCH] Update flaskr-ci.yaml --- .github/workflows/flaskr-ci.yaml | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/flaskr-ci.yaml b/.github/workflows/flaskr-ci.yaml index 4e464031..86a6da7b 100644 --- a/.github/workflows/flaskr-ci.yaml +++ b/.github/workflows/flaskr-ci.yaml @@ -37,21 +37,23 @@ jobs: # Required permission to push images with the built-in GITHUB_TOKEN packages: write runs-on: ubuntu-latest + env: + CACHE: "${{ runner.temp }}/.buildx-cache" + NEW_CACHE: "${{ runner.temp }}/.buildx-cache-new" steps: - uses: actions/checkout@v3 - - name: Set job vars + - name: Job vars and prep id: vars run: | echo "SHA_SHORT=${GITHUB_SHA:0:10}" >> ${GITHUB_ENV} echo "REPO_LOWER_CASE=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV} - # This is a separate action that sets up buildx runner - - name: Set up Docker Buildx + mkdir -p ${CACHE} + - name: Setup Docker Buildx uses: docker/setup-buildx-action@v1 - # So now you can use Actions' own caching! - - name: Cache Docker layers + - name: Setup cache for Docker Buildx uses: actions/cache@v2 with: - path: /tmp/.buildx-cache + path: ${{ env.CACHE }} key: flaskr-buildx-${{ github.ref_name }} restore-keys: | flaskr-buildx-main @@ -68,8 +70,8 @@ jobs: push: true # tags: "ghcr.io/${{ github.repository }}:${{ steps.vars.outputs.sha_short }}" tags: "ghcr.io/${{ env.REPO_LOWER_CASE }}:${{ env.SHA_SHORT }}" - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new + cache-from: type=local,src=${{ env.CACHE }} + cache-to: type=local,dest=${{ env.NEW_CACHE }} # This ugly bit is necessary if you don't want your cache to grow forever # until it hits GitHub's limit of 5GB. # Temp fix @@ -77,5 +79,5 @@ jobs: # https://github.com/moby/buildkit/issues/1896 - name: Move cache run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache + rm -rf $CACHE + mv $NEW_CACHE $CACHE