Skip to content

Instantly share code, notes, and snippets.

@uptimizt
Forked from khoipro/.gitlab-ci.yml
Created December 16, 2020 07:25
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 uptimizt/eafc65022ba1f3a8b84bdfd44e3376d4 to your computer and use it in GitHub Desktop.
Save uptimizt/eafc65022ba1f3a8b84bdfd44e3376d4 to your computer and use it in GitHub Desktop.
Deploy from GitLab to WPEngine (Tested)
stages:
- deploy_dev
- deploy_staging
- deploy_live
before_script:
- 'which ssh-agent || ( apk add --update openssh )'
- apk add --update bash
- apk add --update git
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY"
- echo "$SSH_PRIVATE_KEY" | ssh-add -
- mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
Deploy Dev:
stage: deploy_dev
script:
- git remote add dev $WPENGINE_DEV_GIT
- "git checkout -b dev"
- "git push dev HEAD:master --force"
only:
- develop
Deploy Staging:
stage: deploy_staging
script:
- git remote add staging $WPENGINE_STAGING_GIT
- "git checkout -b staging"
- "git push staging HEAD:master --force"
only:
- master
Deploy Live:
stage: deploy_live
when: manual
script:
- git remote add live $WPENGINE_LIVE_GIT
- "git checkout -b live"
- "git push live HEAD:master --force"
only:
- tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment