Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
56 lines (45 sloc) 1.43 KB
version: 2
jobs:
build:
branches:
ignore:
- gh-pages
docker:
- image: circleci/node:10.10
working_directory: ~/loige.co
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run:
name: Install dependencies
command: yarn
- run:
name: Test
command: yarn test
- run:
name: Build
command: yarn build
- save_cache:
paths:
- node_modules
- .cache
key: v1-dependencies-{{ checksum "package.json" }}
- deploy:
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
echo "$DOMAIN" > public/CNAME
cp -r .circleci public/.circleci
git config --global user.email "$GH_EMAIL"
git config --global user.name "$GH_NAME"
NODE_DEBUG=gh-pages yarn deploy -- -m 'automated build from circleci'
curl -X DELETE "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE/purge_cache" \
-H "X-Auth-Email: $CLOUDFLARE_EMAIL" \
-H "X-Auth-Key: $CLOUDFLARE_AUTH_KEY" \
-H "Content-Type: application/json" \
--data '{"purge_everything":true}'
else
echo "Not in master branch, not deploying"
fi