Kaynağa Gözat

cache with date suffix key for build-dev job

Yuki Takei 6 yıl önce
ebeveyn
işleme
600986d3c3
1 değiştirilmiş dosya ile 17 ekleme ve 0 silme
  1. 17 0
      .github/workflows/ci.yml

+ 17 - 0
.github/workflows/ci.yml

@@ -141,6 +141,23 @@ jobs:
       with:
         path: node_modules
         key: ${{ runner.OS }}-node_modules-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
+    - name: Get Date
+      run: |
+        echo ::set-env name=DateYmdHM::$(date '+%Y%m%d%H%M')
+        echo ::set-env name=DateYmdH::$(date '+%Y%m%d%H')
+        echo ::set-env name=DateYmd::$(date '+%Y%m%d')
+        echo ::set-env name=DateYm::$(date '+%Y%m')
+        echo ::set-env name=DateY::$(date '+%Y')
+    - name: Cache/Restore node_modules/.cache
+      uses: actions/cache@v1
+      with:
+        path: node_modules/.cache
+        key: ${{ runner.OS }}-node_modules_cache-${{ matrix.node-version }}-${{ env.DateYmdHM }}
+        restore-keys: |
+          ${{ runner.os }}-node_modules_cache-${{ matrix.node-version }}-${{ env.DateYmdH }}
+          ${{ runner.os }}-node_modules_cache-${{ matrix.node-version }}-${{ env.DateYmd }}
+          ${{ runner.os }}-node_modules_cache-${{ matrix.node-version }}-${{ env.DateYm }}
+          ${{ runner.os }}-node_modules_cache-${{ matrix.node-version }}-${{ env.DateY }}
     - name: Get yarn cache dir
       if: steps.cache-dependencies.outputs.cache-hit != 'true'
       id: cache-yarn