Skip to content

Instantly share code, notes, and snippets.

@knowbody
Created May 31, 2017 07:59
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save knowbody/304fd5417772da5cf637bec68320a799 to your computer and use it in GitHub Desktop.
Save knowbody/304fd5417772da5cf637bec68320a799 to your computer and use it in GitHub Desktop.
Zeit now.sh and CircleCI config
machine:
environment:
PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"
node:
version: 7.10.0
dependencies:
override:
- yarn
cache_directories:
- ~/.cache/yarn
pre:
- yarn global add now
test:
override:
- yarn test
deployment:
development:
branch: master
commands:
- now -t ${NOW_TOKEN}
- now -t ${NOW_TOKEN} alias foo-dev
production:
branch: production
commands:
- now -t ${NOW_TOKEN}
- now -t ${NOW_TOKEN} alias foo
{
"alias": [
"foo",
"foo-dev"
],
"forwardNpm": true
}
@knowbody
Copy link
Author

This setup tells CircleCI to use yarn instead of npm.
It installs now globally, overrides the default test script with yarn test.
It deploy from two branches master and production.
To use now alias without now alias set, the alias property needs to be set in now.json.
I also use forwardNpm flag, so now uses .npmrc to access the private modules.

NOW_TOKEN was generated on the https://now.sh and is set as an env variable on CircleCI dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment