瀏覽代碼

chore(ci): cache go modules with unified key to reduce cache size

Hintay 2 月之前
父節點
當前提交
dc0d31ff54
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      .github/workflows/build.yml

+ 11 - 1
.github/workflows/build.yml

@@ -157,13 +157,23 @@ jobs:
           echo "DIST=nginx-ui-$_NAME" >> $GITHUB_ENV
           echo "ARTIFACT=$_ARTIFACT" >> $GITHUB_ENV
 
-      - name: Setup go caches
+      - name: Setup Go modules cache
         uses: actions/cache@v4
         with:
           path: |
             ~/go/pkg/mod
+          key: go-${{ runner.os }}-${{ runner.arch }}-mod-${{ hashFiles('go.mod') }}
+          restore-keys: |
+            go-${{ runner.os }}-${{ runner.arch }}-mod-
+
+      - name: Setup Go build cache
+        uses: actions/cache@v4
+        with:
+          path: |
             ~/.cache/go-build
           key: go-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NAME }}-${{ hashFiles('go.mod') }}
+          restore-keys: |
+              go-${{ runner.os }}-${{ runner.arch }}-${{ env.CACHE_NAME }}-
 
       - name: Download app artifacts
         uses: actions/download-artifact@v4