From e81737841395664e71b8ff0accd30170aed41e8d Mon Sep 17 00:00:00 2001 From: Mac Siri Date: Wed, 6 Mar 2024 15:04:30 -0500 Subject: [PATCH] [CI] Add cache creator (#20740) --- .github/workflows/create-cache.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/create-cache.yml diff --git a/.github/workflows/create-cache.yml b/.github/workflows/create-cache.yml new file mode 100644 index 000000000..b685fc8f5 --- /dev/null +++ b/.github/workflows/create-cache.yml @@ -0,0 +1,36 @@ +name: Create CI cache + +on: + push: + branches: + - main + +jobs: + install: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + - name: Cache node_modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-v2-${{ hashFiles('**/yarn.lock') }} + restore-keys: ${{ runner.os }}-node-modules-v2- + - uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + - run: yarn install --immutable + - name: cache compiled assets exist + uses: actions/cache@v4 + with: + fail-on-cache-miss: false + path: | + public/assets + key: ${{ runner.os }}-compiled-assets-v3-${{ hashFiles('app/assets/**', 'app/javascript/**', '**/package.json', '**/yarn.lock') }} + restore-keys: ${{ runner.os }}-compiled-assets-v3- + - run: bundle exec rails assets:precompile