Skip to content

Instantly share code, notes, and snippets.

@Rayjax
Last active Feb 24, 2019
Embed
What would you like to do?
Sample gitlab ci file for node-ci project
image: node:6.10.3
stages:
- ver
- init
- tests
- deploy
ver:
stage: ver
script:
- node --version
- whoami
init:
stage: init
script:
- npm cache clean
- rm -rf node-modules
- npm install
run_tests:
stage: tests
script:
- npm test
deploy_staging:
stage: deploy
script:
- git remote add heroku https://heroku:$HEROKU_API_KEY@git.heroku.com/gitlab-node-ci-staging.git
- git push heroku master
- echo "Deployed to staging server"
environment:
name: staging
url: https://gitlab-node-ci-staging.herokuapp.com/
only:
- master
deploy_production:
stage: deploy
script:
- git remote add heroku https://heroku:$HEROKU_API_KEY@git.heroku.com/gitlab-node-ci.git
- git push heroku master
- echo "Deployed to production server"
environment:
name: production
url: https://gitlab-node-ci.herokuapp.com/
when: manual
only:
- master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment