Skip to content

Commit

Permalink
fix(cicd): fixed cache management
Browse files Browse the repository at this point in the history
  • Loading branch information
JBBianchi committed Nov 29, 2023
1 parent 2a487df commit c338d39
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 18 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/js-build-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,25 @@ jobs:
with:
node-version: 18

- name: Cache dependencies
uses: actions/cache@v3
- name: Restore cached dependencies
uses: actions/cache/restore@v3
with:
path: ${{ format('{0}/{1}/', inputs.path, 'node_modules') }}
path: ${{ format('{0}{1}/', inputs.path, 'node_modules') }}
key: ${{ inputs.name }}-node_modules

- name: Restore build artifacts
uses: actions/cache/restore@v3
with:
path: ${{ format('{0}{1}/', inputs.path, 'dist') }}
key: ${{ inputs.name }}-dist

- name: Build
run: |
cd ${{ inputs.path }}
npx ng b ${{ inputs.name }} --configuration=production
- name: Cache build
uses: actions/cache@v3
- name: Save build artifacts
uses: actions/cache/save@v3
with:
path: ${{ format('{0}/{1}/', inputs.path, 'dist') }}
path: ${{ format('{0}{1}/', inputs.path, 'dist') }}
key: ${{ inputs.name }}-dist
6 changes: 3 additions & 3 deletions .github/workflows/js-lint-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
with:
node-version: 18

- name: Cache dependencies
uses: actions/cache@v3
- name: Restore cached dependencies
uses: actions/cache/restore@v3
with:
path: ${{ format('{0}/{1}/', inputs.path, 'node_modules') }}
path: ${{ format('{0}{1}/', inputs.path, 'node_modules') }}
key: ${{ inputs.name }}-node_modules

- name: Lint
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/js-publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
with:
node-version: 18

- name: Cache build
uses: actions/cache@v3
- name: Restore build artifacts
uses: actions/cache/restore@v3
with:
path: ${{ format('{0}/{1}/', inputs.path, 'dist') }}
path: ${{ format('{0}{1}/', inputs.path, 'dist') }}
key: ${{ inputs.name }}-dist

- name: Publish package
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/js-restore-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18

- name: Restore cached dependencies
uses: actions/cache/restore@v3
with:
path: ${{ format('{0}{1}/', inputs.path, 'node_modules') }}
key: ${{ inputs.name }}-node_modules

- name: Restore dependencies
run: |
Expand All @@ -37,8 +43,8 @@ jobs:
cd ${{ inputs.path }}
npm i ${{ inputs.dependencies }}
- name: Cache dependencies
uses: actions/cache@v3
- name: Save cached dependencies
uses: actions/cache/save@v3
with:
path: ${{ format('{0}/{1}/', inputs.path, 'node_modules') }}
path: ${{ format('{0}{1}/', inputs.path, 'node_modules') }}
key: ${{ inputs.name }}-node_modules
6 changes: 3 additions & 3 deletions .github/workflows/js-test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ jobs:
with:
node-version: 18

- name: Cache dependencies
uses: actions/cache@v3
- name: Restore cached dependencies
uses: actions/cache/restore@v3
with:
path: ${{ format('{0}/{1}/', inputs.path, 'node_modules') }}
path: ${{ format('{0}{1}/', inputs.path, 'node_modules') }}
key: ${{ inputs.name }}-node_modules

- name: Test
Expand Down

0 comments on commit c338d39

Please sign in to comment.