wpengine / github-action-wpe-site-deploy

A GitHub Action to deploy code directly to WP Engine.
MIT License
173 stars 36 forks source link

Check if the script is in the remote host and copy if not #12

Closed marksabbath closed 2 years ago

marksabbath commented 2 years ago

JIRA Ticket

What Are We Doing Here

This PR introduces a verification when the post script is set to run. The approach used is: 1. Check if the script exists in the remote host. If exists, run the version in the remote host, if it doesn't exists in the remote host, it will check if the script exists in the repository and rsync it to the remote host and execute.

marksabbath commented 2 years ago

Something I noticed in testing was that it's not possible to update the script if you don't include any kind of self-destruct code (i.e. rm ./path/to/script.sh). The script will remain on the server, which causes the rsync to be skipped on the next deploy.

Would it make sense to just rsync the script regardless of whether the file already exists on the remote?

Hey @apmatthews we've discussed that approach in our standup. @alexanderzuniga proposed that we follow this path implemented but we definitely can revisit it and chat about that when you are back. There's no rush to merge this PR.