Skip to content

Commit

Permalink
chore: Update installation and cache actions in GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
codemile committed Jun 1, 2024
1 parent e7576b6 commit e3a3c97
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 19 deletions.
19 changes: 19 additions & 0 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: "📥 Install"
description: "📥 Install dependencies"

runs:
using: "composite"
steps:
- name: "💽 Restore node_modules cache"
uses: actions/cache@v4
id: cache-node-modules
with:
path: "node_modules"
key: ${{ runner.os }}-${{ runner.arch }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-node-
- name: "📥 Install dependencies"
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
shell: bash
run: yarn install --frozen-lockfile
13 changes: 13 additions & 0 deletions .github/actions/next-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: "📥 NestJS cache"
description: "📥 Cache NestJS dependencies"

runs:
using: "composite"
steps:
- name: "💽 Restore .next/cache cache"
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.next/cache
key: ${{ runner.os }}-${{ runner.arch }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
restore-keys: |
${{ runner.os }}-${{ runner.arch }}-nextjs-${{ hashFiles('**/yarn.lock') }}-
25 changes: 10 additions & 15 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ jobs:
cache: "yarn"

- name: "📦 Install dependencies"
uses: reactgular/cache@v1
with:
mode: "install"
uses: ./.github/actions/install

lint:
runs-on: ubuntu-latest
Expand All @@ -48,10 +46,8 @@ jobs:
node-version: "20"
cache: "yarn"

- name: "💽 Restore node_modules cache"
uses: reactgular/cache@v1
with:
mode: "restore"
- name: "📦 Install dependencies"
uses: ./.github/actions/install

- name: "🔨 Lint"
run: yarn lint
Expand Down Expand Up @@ -92,10 +88,8 @@ jobs:
node-version: "20"
cache: "yarn"

- name: "💽 Restore node_modules cache"
uses: reactgular/cache@main
with:
mode: "restore"
- name: "📦 Install dependencies"
uses: ./.github/actions/install

- name: "🔨 Build storybooks"
run: yarn build-storybook
Expand All @@ -114,10 +108,11 @@ jobs:
node-version: "20"
cache: "yarn"

- name: "💽 Restore node_modules cache"
uses: reactgular/cache@v1
with:
mode: "restore"
- name: "📦 Install dependencies"
uses: ./.github/actions/install

- name: "💽 Restore .next/cache cache"
uses: ./.github/actions/next-cache

- name: "🔨 Build"
run: yarn build
9 changes: 5 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ jobs:
node-version: "20"
cache: "yarn"

- name: "💽 Restore node_modules cache"
uses: reactgular/cache@v1
with:
mode: "restore"
- name: "📦 Install dependencies"
uses: ./.github/actions/install

- name: "💽 Restore .next/cache cache"
uses: ./.github/actions/next-cache

- name: "🔧 Setup Pages"
uses: actions/configure-pages@v5
Expand Down

0 comments on commit e3a3c97

Please sign in to comment.