Skip to content

Commit 491cc62

Browse files
committed
fix: Use circle workflow ID for caches
1 parent e9f9781 commit 491cc62

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

.circleci/config.yml

+10-8
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ jobs: # a collection of steps
1212
steps:
1313
- checkout
1414
- restore_cache: # special step to restore the dependency cache
15-
key: dependency-cache-{{ checksum "package-lock.json" }}
15+
key: dependency-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
1616
- run:
1717
name: Install NPM Dependencies
1818
command: npm i
1919
- save_cache: # special step to save the dependency cache
20-
key: dependency-cache-{{ checksum "package-lock.json" }}
20+
key: dependency-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
2121
paths:
2222
- ~/tmp/node_modules
2323

@@ -26,7 +26,7 @@ jobs: # a collection of steps
2626
steps:
2727
- checkout
2828
- restore_cache:
29-
key: dependency-cache-{{ checksum "package-lock.json" }}
29+
key: dependency-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
3030
- run: # run linter
3131
name: Linting
3232
command: npm run lint:ci
@@ -40,7 +40,7 @@ jobs: # a collection of steps
4040
steps:
4141
- checkout
4242
- restore_cache:
43-
key: dependency-cache-{{ checksum "package-lock.json" }}
43+
key: dependency-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
4444
- run:
4545
name: Add Git User details
4646
command: |
@@ -50,18 +50,20 @@ jobs: # a collection of steps
5050
name: Bump version and generate changelog
5151
command: npm run release:ci
5252
- save_cache: # special step to save the changelog
53-
key: changelog-cache-{{ checksum "package-lock.json" }}
53+
key: changelog-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
5454
paths:
5555
- ~/tmp/CHANGELOG.md
56+
- ~/tmp/package-lock.json
57+
- ~/tmp/package.json
5658

5759
build: # build the project - requires dependencies to have been installed
5860
executor: node-project
5961
steps:
6062
- checkout
6163
- restore_cache:
62-
key: dependency-cache-{{ checksum "package-lock.json" }}
64+
key: dependency-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
6365
- restore_cache:
64-
key: changelog-cache-{{ checksum "package-lock.json" }}
66+
key: changelog-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
6567
- run: # run build
6668
name: Build
6769
command: |
@@ -83,7 +85,7 @@ jobs: # a collection of steps
8385
- restore_cache: # restore the /public folder and associated deploy files
8486
key: deploy-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
8587
- restore_cache: # special step to restore the dependency cache
86-
key: dependency-cache-{{ checksum "package-lock.json" }}
88+
key: dependency-cache-{{ .Environment.CIRCLE_WORKFLOW_ID }}
8789
- run:
8890
name: Deploy to Firebase Hosting
8991
command: ./node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN"

0 commit comments

Comments
 (0)