Skip to content

Instantly share code, notes, and snippets.

@hilkeheremans
Created April 28, 2016 11:13
Show Gist options
  • Save hilkeheremans/5866ef2957eec9ccb010383077300aec to your computer and use it in GitHub Desktop.
Save hilkeheremans/5866ef2957eec9ccb010383077300aec to your computer and use it in GitHub Desktop.
Drone CI with nodejs, npm and private modules
# drone.yml for node js CI with npm login
# Don't forget to configure DRONE_SERVER and DRONE_SERVER
# Now create a secrets.yml (OUTSIDE of your repo!!) (see other file)
# then run drone secure --repo <drone_repo_name> --in <path>/secrets.yml
build:
unit_tests:
image: risingstack/alpine:3.3-v4.2.6-1.1.3
commands:
- npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
- npm install
- npm run build
- npm run test
# the environment is transient so cleanup isn't really necessary
environment:
- NPM_TOKEN="$$NPM_TOKEN"
cache:
mount:
- node_modules
# set this to npm token in ~/.npmrc, can be revoked via npmjs.com later
# Do not commit this to any repo (duh)
environment:
NPM_TOKEN: <npm_token>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment