Просмотр исходного кода

apply layer cache when to release.yml workflow

Yuki Takei 4 лет назад
Родитель
Сommit
7ebd6037e1
1 измененных файлов с 15 добавлено и 0 удалено
  1. 15 0
      .github/workflows/release.yml

+ 15 - 0
.github/workflows/release.yml

@@ -100,6 +100,14 @@ jobs:
     - name: Set up Docker Buildx
     - name: Set up Docker Buildx
       uses: docker/setup-buildx-action@v1
       uses: docker/setup-buildx-action@v1
 
 
+    - name: Cache Docker layers
+      uses: actions/cache@v2
+      with:
+        path: /tmp/.buildx-cache
+        key: ${{ runner.os }}-buildx-app-${{ github.sha }}
+        restore-keys: |
+          ${{ runner.os }}-buildx-app-
+
     - name: Build and push
     - name: Build and push
       uses: docker/build-push-action@v2
       uses: docker/build-push-action@v2
       with:
       with:
@@ -107,8 +115,15 @@ jobs:
         file: ./docker/Dockerfile
         file: ./docker/Dockerfile
         platforms: linux/amd64
         platforms: linux/amd64
         push: true
         push: true
+        cache-from: type=local,src=/tmp/.buildx-cache
+        cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-new
         tags: ${{ steps.meta.outputs.tags }}
         tags: ${{ steps.meta.outputs.tags }}
 
 
+    - name: Move cache
+      run: |
+        rm -rf /tmp/.buildx-cache
+        mv /tmp/.buildx-cache-new /tmp/.buildx-cache
+
     - name: Update Docker Hub Description
     - name: Update Docker Hub Description
       uses: peter-evans/dockerhub-description@v2
       uses: peter-evans/dockerhub-description@v2
       with:
       with: