Skip to content

Commit

Permalink
ci/cd (#131): cache after installation and building the project not a…
Browse files Browse the repository at this point in the history
…t the beginning
  • Loading branch information
navid-kalaei committed May 13, 2022
1 parent 69b0a1d commit 9f706b3
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,33 @@ jobs:
node-version: lts/*
cache: 'yarn'

- name: Install yarn
run: npm install -g yarn

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Install yarn
- name: Install front-end dependancies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: npm install -g yarn
run: yarn install

- uses: actions/cache@v3
- name: Install process manager
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn add pm2

- name: Cache yarn
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Build front-end
run: yarn build:dev

- name: Cache NextJS
uses: actions/cache@v3
with:
Expand All @@ -50,17 +61,6 @@ jobs:
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-
- name: Install front-end dependancies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install

- name: Install process manager
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn add pm2

- name: Build front-end
run: yarn build:dev

- name: Setup python
uses: actions/setup-python@v2

Expand Down

0 comments on commit 9f706b3

Please sign in to comment.