Skip to content

Instantly share code, notes, and snippets.

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 dfroberg/1511647ccb057129a72d8e92e84b92a3 to your computer and use it in GitHub Desktop.
Save dfroberg/1511647ccb057129a72d8e92e84b92a3 to your computer and use it in GitHub Desktop.
.gitlab-ci.yml
before_script:
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- echo "$PRIVATEKEY" | tr -d '\r' | ssh-add - > /dev/null
stages:
- deploy_staging
- deploy_master
Deploy Master:
stage: deploy_master
script:
- git remote add production $production-remote-url
- "git checkout -b master"
- "git push production master:master -f"
only:
- master
Deploy Staging:
stage: deploy_staging
script:
- git remote add staging $staging-remote-url
- "git checkout -b staging"
- "git push staging staging:master -f"
only:
- staging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment