Skip to content

Instantly share code, notes, and snippets.

@gyorgygutai
Created February 7, 2020 09:04
Show Gist options
  • Save gyorgygutai/f5bbd3fbeff5e86d9f85928b838afaba to your computer and use it in GitHub Desktop.
Save gyorgygutai/f5bbd3fbeff5e86d9f85928b838afaba to your computer and use it in GitHub Desktop.
Gatsby CircleCI deploy pipeline
version: 2
workflows:
version: 2
build-deploy:
jobs:
- release:
filters:
branches:
only:
- master
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- release
jobs:
release:
docker:
- image: circleci/node:10
working_directory: ~/gatsby-site
steps:
- checkout
- restore_cache:
keys:
- yarn-cache-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: yarn install && npm rebuild
- save_cache:
key: yarn-cache-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
- restore_cache:
keys:
- v1-gatsby-public-cache-{{ .Branch }}
- run:
name: Gatsby Build
command: GATSBY_CPU_COUNT=2 yarn build
- run:
name: Print public Folder Size
command: du -sh ./public
- save_cache:
key: v1-gatsby-public-cache-{{ .Branch }}-{{ epoch }}
paths:
- ./public
- ./.cache
- run:
name: Netlify Deploy
command: ./node_modules/.bin/netlify deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_ACCESS_TOKEN --prod --dir=public
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment