Skip to content

Instantly share code, notes, and snippets.

@daviddarke
Last active May 21, 2024 14:17
Show Gist options
  • Save daviddarke/f79ce22abcf19e185f42b3a4db7ec768 to your computer and use it in GitHub Desktop.
Save daviddarke/f79ce22abcf19e185f42b3a4db7ec768 to your computer and use it in GitHub Desktop.
Gitlab pipeline to push to WP Engine
stages:
- deploy
Deploy:
before_script:
## Install ssh-agent if not already installed, it is required by Docker.
## (change apt-get to yum if you use an RPM-based image)
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
## Create the SSH directory and give it the right permissions
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
## Run ssh-agent (inside the build environment)
- eval $(ssh-agent -s)
- echo "$SSH_PRIV_KEY" | tr -d '\r' | ssh-add -
script:
- "git push git@git.wpengine.com:production/WEBSITE.git HEAD:master --force"
when: on_success
stage: deploy
only:
- master
tags:
- wordpress
environment:
name: Production
url: https://www.WEBSITE.com
allow_failure: false
@axmichell
Copy link

Hi David, my name is Alejandro and I have been looking for something like this; thank you for yml file. I am not sure if you check messages here, but in case you do. . .the one thing that is not working for me is this line: "git push git@git.wpengine.com:production/WEBSITE.git HEAD:master --force" I get an error about "the destination you provided is not a full refname. . . any thoughts. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment