chore: cache gatsby builds between workflow runs (#746)

Luke Karrys committed Oct 13, 2023 at 20:55 UTC dffba56cc92a389d4f9da493da9ade49f89029d3
3 files changed +46 -1
.github/workflows/publish.yml
+22
@@ -84,12 +84,34 @@ jobs:
84 run: npm -v
85 - name: Install Dependencies
86 run: npm i --no-audit --no-fund
87 + - name: Rebuild deps
88 + run: npm rebuild
89 +
90 - name: Setup Pages
91 uses: actions/configure-pages@v1
92 +
93 + - name: Restore cache
94 + id: cache-gatsby
95 + uses: actions/cache/restore@v3
96 + with:
97 + key: ${{ runner.os }}-gatsby-${{ github.ref_name }}
98 + path: |
99 + public
100 + .cache
101 +
102 - name: Build documentation
103 run: npm run build
104 env:
105 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
106 +
107 + - name: Save cache
108 + uses: actions/cache/save@v3
109 + with:
110 + key: ${{ steps.cache-gatsby.outputs.cache-primary-key }}
111 + path: |
112 + public
113 + .cache
114 +
115 - name: Upload artifact
116 uses: actions/upload-pages-artifact@v1
117 with:
package.json
+2 -1
@@ -8,7 +8,8 @@
8 "private": true,
9 "scripts": {
10 "develop": "gatsby develop",
11 - "build": "NODE_OPTIONS=--max-old-space-size=7168 gatsby build",
11 + "build": "NODE_OPTIONS=--max-old-space-size=7168 gatsby build --verbose --log-pages",
12 + "clean": "rm -rf .cache/ public/",
13 "serve": "gatsby serve",
14 "lint": "eslint \"**/*.js\"",
15 "postlint": "template-oss-check",
scripts/template-oss/publish.yml
+22
@@ -23,12 +23,34 @@ jobs:
23 shell: bash
24 steps:
25 {{> stepsSetup }}
26 + - name: Rebuild deps
27 + run: npm rebuild
28 +
29 - name: Setup Pages
30 uses: actions/configure-pages@v1
31 +
32 + - name: Restore cache
33 + id: cache-gatsby
34 + uses: actions/cache/restore@v3
35 + with:
36 + key: $\{{ runner.os }}-gatsby-$\{{ github.ref_name }}
37 + path: |
38 + public
39 + .cache
40 +
41 - name: Build documentation
42 run: npm run build
43 env:
44 GITHUB_TOKEN: $\{{ secrets.GITHUB_TOKEN }}
45 +
46 + - name: Save cache
47 + uses: actions/cache/save@v3
48 + with:
49 + key: $\{{ steps.cache-gatsby.outputs.cache-primary-key }}
50 + path: |
51 + public
52 + .cache
53 +
54 - name: Upload artifact
55 uses: actions/upload-pages-artifact@v1
56 with: