Bash script for deploying Wordpress projects based on Roots/Bedrock & Roots/Sage to any server.
Tested on: Sage 9, on OS X system.
To understand what the script does, it's best to check the script itself.
But to get the basic idea, these are the main pseudo-code steps (also the actual functions called in the script, if you check the bottom part of the deploy.sh)
removes local temporary files that might have been built using this script previously
clones your predefined repository
runs composer 1x for Bedrock & 1x for Sage
runs yarn install & build inside predefined Sage theme
prepares DEPLOY_TEMP folder for deployment
zips the DEPLOY_TEMP folder
transfers the above folder to the predefined server
connects to predefined server and executes commands that
- makes a backup of the folder we are deploying to (.zip)
- unzips our new deploy folder transfered in step 7.
- copies uploads, languages, .env and such to our new deploy folder
- copies over plugins but does not overwrite existing plugins (only those that are not a composer dependency)
- copies over web/app/languages/wpml (translation .mo files generated by WPML since v.4.3.0!) - overwrites
- removes our deploy zipped folder
- activates maintenance mode
- renames actual domain folder to your_domain.com_BEFORE_DEPLOY (adds "_BEFORE_DEPLOY")
- renames our prepared deploy folder (DEPLOY_TEMP) to the name of the actual domain folder we had before
- activates our theme and plugins, assigns menus, sets permalinks (you can disable all this if you wish, check the code)
To be able to use the script, follow these steps:
- Read HOW IT WORKS section above.
- Define VARIABLES inside deploy.sh carefully (See comments in the script itself for hints/help).
- Run the script
sh deploy.sh --verbose
- enjoy life
See https://github.com/trainoasis/deploy-wp-bedrock-sage-gitlab-ci for YML script.