Skip to content

Instantly share code, notes, and snippets.

@Rayjax
Last active February 24, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rayjax/ef07ef029b19a0312808deee89d202a1 to your computer and use it in GitHub Desktop.
Save Rayjax/ef07ef029b19a0312808deee89d202a1 to your computer and use it in GitHub Desktop.
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