Skip to content

Instantly share code, notes, and snippets.

@unkray
Forked from shaliko/.gitlab-ci.yml
Last active December 14, 2020 07:44
Show Gist options
  • Select an option

  • Save unkray/43a143ba51c370489f8ced4d9c6280f9 to your computer and use it in GitHub Desktop.

Select an option

Save unkray/43a143ba51c370489f8ced4d9c6280f9 to your computer and use it in GitHub Desktop.
GitLab Continuous Integration with Capistrano 3
# Take valid private key for $SSH_PRIVATE_KEY variable to the agent store
# cat .ssh/id_rsa | base64 -w0 >> ./deploy_key
image: ruby:2.6
stages:
- deploy
deploy_testing:
environment:
name: testing
url: http://testing.host.com/
stage: deploy
script:
- which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 --decode)
- gem install capistrano
- cap testing deploy
only:
- testing
tags:
- deploy_testing
deploy:
environment:
name: main
url: http://main.host.com/
stage: deploy
script:
- which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 --decode)
- gem install capistrano
- cap main deploy
only:
- main
tags:
- deploy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment