Skip to content

Instantly share code, notes, and snippets.

@timilsinabishal
Created June 28, 2017 08:23
Show Gist options
  • Save timilsinabishal/0fe5cb178e97d741183265597361a1aa to your computer and use it in GitHub Desktop.
Save timilsinabishal/0fe5cb178e97d741183265597361a1aa to your computer and use it in GitHub Desktop.
Gitlab CI file for continous deployment using capistrano
image: ruby:latest
before_script:
- which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
- eval $(ssh-agent -s)
- ssh-add <(echo -e "$SSH_PRIVATE_KEY")
- gem install capistrano
stages:
- deploy
staging:
stage: deploy
script:
- cap staging deploy user=${GITLAB_USER_EMAIL} branch=${CI_COMMIT_REF_NAME}
only:
- develop
production:
stage: deploy
script:
- cap production deploy user=${GITLAB_USER_EMAIL} branch=${CI_COMMIT_REF_NAME}
only:
- tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment