From ffc18b13fbfa61f82dd1f0ddaf57a993f3a63edc Mon Sep 17 00:00:00 2001 From: Deon George Date: Sat, 4 Jan 2025 17:57:35 +1100 Subject: [PATCH] Cache page assets during CI/CD --- .gitea/workflows/build_docker.yaml | 49 ++++++++++++++++-------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/.gitea/workflows/build_docker.yaml b/.gitea/workflows/build_docker.yaml index 343e067..1b84449 100644 --- a/.gitea/workflows/build_docker.yaml +++ b/.gitea/workflows/build_docker.yaml @@ -55,17 +55,17 @@ jobs: - name: Cache page assets id: cache-page-assets uses: actions/cache@v3 - env: - cache-name: page-assets +# env: +# cache-name: page-assets with: path: | public/css/app.css public/js/app.js public/js/vendor.js - key: - ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-build-${{ env.cache-name }}- + #key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + key: build-pla-page-assets-${{ hashFiles('**/package-lock.json') }} + #restore-keys: | + # ${{ runner.os }}-build-${{ env.cache-name }}- build: strategy: @@ -113,25 +113,28 @@ jobs: - name: Code Checkout uses: actions/checkout@v4 -# - name: Cache page assets -# id: cache-page-assets -# uses: actions/cache@v3 + - name: Cache page assets + id: cache-page-assets + uses: actions/cache@v3 # env: # cache-name: page-assets -# with: -# path: | -# public/css/app.css -# key: -# ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} -# restore-keys: | -# ${{ runner.os }}-build-${{ env.cache-name }}- -# -# - if: ${{ steps.cache-page-assets.outputs.cache-hit != 'true' }} -# name: List the state of page assets -# continue-on-error: false -# run: | -# ls -al public/css/ -# ls -al public/js/ + with: + path: | + public/css/app.css + public/js/app.js + public/js/vendor.js + #key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + key: build-pla-page-assets-${{ hashFiles('**/package-lock.json') }} + #restore-keys: | + # ${{ runner.os }}-build-${{ env.cache-name }}- + + - if: ${{ steps.cache-page-assets.outputs.cache-hit != 'true' }} + name: List the state of page assets + continue-on-error: false + run: | + echo CACHE-HIT:${{ steps.cache-page-assets.outputs.cache-hit }} + ls -al public/css/ + ls -al public/js/ - name: Record version and Delete Unnecessary files run: |