Skip to content

Commit

Permalink
cache-hit
Browse files Browse the repository at this point in the history
  • Loading branch information
compojoom committed Dec 17, 2024
1 parent 53969c3 commit 92fc240
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ description: 'Build the app'
inputs:
secrets:
required: true
description: 'GitHub secrets as JSON'

prod: # id of input
description: 'Production build flag'
Expand Down
17 changes: 8 additions & 9 deletions .github/actions/cache-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ inputs:
required: true

outputs:
cache-primary-key:
value: ${{ steps.restore.outputs.cache-primary-key }}
description: "The primary key used for the cache"
cache-nc-key:
value: ${{ steps.restore-nc.outputs.cache-primary-key }}
description: "The primary key used for the cache"

cache-hit-yarn:
value: ${{ steps.restore.outputs.cache-hit }}
description: "Whether the cache was hit or not"
cache-hit-nc:
value: ${{ steps.restore-nc.outputs.cache-hit }}
description: "Whether the cache was hit or not"
runs:
using: "composite"
steps:
Expand All @@ -32,7 +31,7 @@ runs:
- name: Set composite outputs yarn
if: ${{ inputs.mode == 'restore-yarn' }}
shell: bash
run: echo "cache-primary-key=${{ steps.restore.outputs.cache-primary-key }}" >> $GITHUB_OUTPUT
run: echo "cache-hit-yarn=${{ steps.restore.outputs.cache-hit }}" >> $GITHUB_OUTPUT

- name: Save Yarn Cache
if: ${{ inputs.mode == 'save-yarn' }}
Expand All @@ -59,7 +58,7 @@ runs:
- name: Set composite outputs nc
if: ${{ inputs.mode == 'restore-nc' }}
shell: bash
run: echo "cache-primary-key=${{ steps.restore-nc.outputs.cache-primary-key }}" >> $GITHUB_OUTPUT
run: echo "cache-hit-nc=${{ steps.restore-nc.outputs.cache-hit }}" >> $GITHUB_OUTPUT


- name: Save Nextjs/Cypress Cache
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ jobs:
with:
mode: restore-yarn

- name: Echo cache hit
run: |
echo "Yarn cache hit: ${{ steps.restore-yarn-types.outputs.cache-hit }}"
- name: Yarn install & after-install generate types
if: steps.restore-yarn-types.outputs.cache-hit != 'true'
run: |
Expand Down Expand Up @@ -131,7 +135,7 @@ jobs:
- uses: ./.github/actions/build
with:
secrets: ${{ toJSON(secrets) }}
if: startsWith(github.ref, 'refs/heads/main')
#if: startsWith(github.ref, 'refs/heads/main')

- name: Save Next.js Build Cache & Cypress cache
uses: ./.github/actions/cache-deps
Expand Down

0 comments on commit 92fc240

Please sign in to comment.