Skip to content

Commit ca92d4b

Browse files
committed
save gatsby cache and do incremental builds for staging
1 parent 31f8e61 commit ca92d4b

File tree

3 files changed

+39
-21
lines changed

3 files changed

+39
-21
lines changed

.github/workflows/production.yml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,30 @@ env:
2222
GATSBY_DEFAULT_MAIN_URL: https://${{ secrets.PROD_CI_MAIN_URL }}
2323
GATSBY_DRIFT_API: ${{ secrets.PROD_CI_GATSBY_DRIFT_API }}
2424
GATSBY_GOOGLE_API_KEY: ${{ secrets.PROD_CI_GATSBY_GOOGLE_API_KEY }}
25-
2625
jobs:
26+
update-dependencies:
27+
name: Update node module dependencies
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout project
31+
uses: actions/checkout@v2
32+
- name: Use Node.js 12.xs
33+
uses: actions/setup-node@v1
34+
with:
35+
node-version: '12.x'
36+
registry-url: 'https://registry.npmjs.org'
37+
- name: Restore cache
38+
uses: actions/cache@v2
39+
with:
40+
path: '**/node_modules'
41+
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
42+
- name: Install dependencies
43+
run: npm install
2744
lint:
45+
name: Lint code and prose
2846
runs-on: ubuntu-latest
47+
needs:
48+
- update-dependencies
2949
steps:
3050
- name: Checkout project
3151
uses: actions/checkout@v2
@@ -46,12 +66,15 @@ jobs:
4666
curl -sfL https://install.goreleaser.com/github.com/ValeLint/vale.sh | sh -s v2.4.0
4767
export PATH="./bin:$PATH"
4868
vale -v
49-
- name: Run linter
69+
- name: Lint code
5070
run: |
5171
npm run lint
72+
- name: Lint prose
73+
run: |
5274
export PATH="./bin:$PATH"
5375
npm run lint:prose
54-
build:
76+
build-deploy-prod:
77+
name: Build and deploy to prod
5578
runs-on: ubuntu-latest
5679
needs:
5780
- lint
@@ -72,22 +95,6 @@ jobs:
7295
run: npm install
7396
- name: Build project
7497
run: npm run build
75-
- name: Upload artifact
76-
uses: actions/upload-artifact@v2
77-
with:
78-
name: k6-docs
79-
path: public/
80-
deploy-to-production:
81-
runs-on: ubuntu-latest
82-
needs:
83-
- lint
84-
- build
85-
steps:
86-
- name: Download artifact
87-
uses: actions/download-artifact@v2
88-
with:
89-
name: k6-docs
90-
path: public/
9198
- name: Install AWS CLI dependencies
9299
run: sudo apt-get update && sudo apt-get -y install python-pip python-dev
93100
- name: Install AWS CLI

.github/workflows/staging.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,18 @@ jobs:
9393
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
9494
- name: Install dependencies
9595
run: npm install
96+
- name: Gatsby Cache Folder
97+
uses: actions/cache@v1
98+
with:
99+
key: gatsby-cache-folder
100+
path: .cache
101+
- name: Gatsby Public Folder
102+
uses: actions/cache@v1
103+
with:
104+
key: gatsby-public-folder
105+
path: public
96106
- name: Build project
97-
run: npm run build
107+
run: npm run build:incremental
98108
- name: Install AWS CLI dependencies
99109
run: sudo apt-get update && sudo apt-get -y install python-pip python-dev
100110
- name: Install AWS CLI

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"private": true,
66
"scripts": {
77
"build:gatsby": "gatsby build --prefix-paths",
8+
"build:incremental": "GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --prefix-paths --log-pages",
89
"build": "npm run build:gatsby",
910
"clean": "gatsby clean",
1011
"start": "npm run develop --host=0.0.0.0",
@@ -84,4 +85,4 @@
8485
"lint-staged": "^10.4.0",
8586
"wait-on": "^5.2.0"
8687
}
87-
}
88+
}

0 commit comments

Comments
 (0)