Skip to content

Commit

Permalink
save gatsby cache and do incremental builds for staging
Browse files Browse the repository at this point in the history
  • Loading branch information
simskij committed Oct 15, 2020
1 parent 31f8e61 commit ca92d4b
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 21 deletions.
45 changes: 26 additions & 19 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,30 @@ env:
GATSBY_DEFAULT_MAIN_URL: https://${{ secrets.PROD_CI_MAIN_URL }}
GATSBY_DRIFT_API: ${{ secrets.PROD_CI_GATSBY_DRIFT_API }}
GATSBY_GOOGLE_API_KEY: ${{ secrets.PROD_CI_GATSBY_GOOGLE_API_KEY }}

jobs:
update-dependencies:
name: Update node module dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v2
- name: Use Node.js 12.xs
uses: actions/setup-node@v1
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- name: Restore cache
uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
lint:
name: Lint code and prose
runs-on: ubuntu-latest
needs:
- update-dependencies
steps:
- name: Checkout project
uses: actions/checkout@v2
Expand All @@ -46,12 +66,15 @@ jobs:
curl -sfL https://install.goreleaser.com/github.com/ValeLint/vale.sh | sh -s v2.4.0
export PATH="./bin:$PATH"
vale -v
- name: Run linter
- name: Lint code
run: |
npm run lint
- name: Lint prose
run: |
export PATH="./bin:$PATH"
npm run lint:prose
build:
build-deploy-prod:
name: Build and deploy to prod
runs-on: ubuntu-latest
needs:
- lint
Expand All @@ -72,22 +95,6 @@ jobs:
run: npm install
- name: Build project
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: k6-docs
path: public/
deploy-to-production:
runs-on: ubuntu-latest
needs:
- lint
- build
steps:
- name: Download artifact
uses: actions/download-artifact@v2
with:
name: k6-docs
path: public/
- name: Install AWS CLI dependencies
run: sudo apt-get update && sudo apt-get -y install python-pip python-dev
- name: Install AWS CLI
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,18 @@ jobs:
key: ${{ runner.os }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Gatsby Cache Folder
uses: actions/cache@v1
with:
key: gatsby-cache-folder
path: .cache
- name: Gatsby Public Folder
uses: actions/cache@v1
with:
key: gatsby-public-folder
path: public
- name: Build project
run: npm run build
run: npm run build:incremental
- name: Install AWS CLI dependencies
run: sudo apt-get update && sudo apt-get -y install python-pip python-dev
- name: Install AWS CLI
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"private": true,
"scripts": {
"build:gatsby": "gatsby build --prefix-paths",
"build:incremental": "GATSBY_EXPERIMENTAL_PAGE_BUILD_ON_DATA_CHANGES=true gatsby build --prefix-paths --log-pages",
"build": "npm run build:gatsby",
"clean": "gatsby clean",
"start": "npm run develop --host=0.0.0.0",
Expand Down Expand Up @@ -84,4 +85,4 @@
"lint-staged": "^10.4.0",
"wait-on": "^5.2.0"
}
}
}

0 comments on commit ca92d4b

Please sign in to comment.