Last active
May 18, 2021 01:08
-
-
Save mariovalney/f5c48b2d3ca655ca6a4fb298622f08e1 to your computer and use it in GitHub Desktop.
Revisions
-
mariovalney revised this gist
Jun 28, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,10 +10,12 @@ if ! [ -f ./package.json ]; then fi # Variables # By default you will put staging site GIT here WARNING="WILL DEPLOY TO STAGING" [email protected]:production/examplestaging.git # Check for production parameter to change repository # And here the production site GIT if [ "$1" = "production" ]; then WARNING="WILL DEPLOY TO PRODUCTION" [email protected]:production/example.git -
mariovalney revised this gist
Jun 28, 2020 . 2 changed files with 46 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ image: node:lts pipelines: default: - step: caches: - node deployment: staging name: Deploy to Staging script: - npm ci - npm install --global gulp-cli - node --version - npm --version - gulp --version - git config --global user.email "[email protected]" - git config --global user.name "Your Name" - ./ci/wpengine-deploy.sh - step: caches: - node deployment: production name: Deploy to Production trigger: manual script: - npm ci - npm install --global gulp-cli - node --version - npm --version - gulp --version - git config --global user.email "[email protected]" - git config --global user.name "Your Name" - ./ci/wpengine-deploy.sh production This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,5 @@ #!/usr/bin/env sh BUILD_DIR=build # You can change "package.json" to any filename from your too @@ -10,11 +9,21 @@ if ! [ -f ./package.json ]; then exit fi # Variables WARNING="WILL DEPLOY TO STAGING" [email protected]:production/examplestaging.git # Check for production parameter to change repository if [ "$1" = "production" ]; then WARNING="WILL DEPLOY TO PRODUCTION" [email protected]:production/example.git fi echo "\n***************************" echo "* ATTENTION! *" echo "***************************" echo "\n$WARNING" # I create a directory "ci" to put this script and it creates a # directory "build" to do its job. You can change it to fit your needs @@ -61,6 +70,8 @@ rm -r wp-content/themes/example/source echo "\n 4 - Pushing...\n" echo "Will push to $REPO\n" # Now you add everyting. # The unchanged files will not be a problem because we added it back. # -
mariovalney revised this gist
Feb 11, 2020 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -73,7 +73,7 @@ echo "\n 5 - Cleaning build\n" # Returning to root # Remember to change it if you are not using my structure cd ../../.. rm -rf ci/$BUILD_DIR echo "\nFinished" -
mariovalney created this gist
Feb 11, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,79 @@ #!/usr/bin/env sh [email protected]:production/example.git BUILD_DIR=build # You can change "package.json" to any filename from your too # or just scape this check if you are sure it will always run on root. if ! [ -f ./package.json ]; then echo "You should run wpengine-deploy.sh on root directory" exit fi echo "\n***************************" echo "* ATTENTION! *" echo "***************************" echo "\nWILL DEPLOY TO PRODUCTION" # I create a directory "ci" to put this script and it creates a # directory "build" to do its job. You can change it to fit your needs rm -rf ci/$BUILD_DIR echo "\n 1 - Preparing release...\n" # Prepare your release here: # You can do anything you do on your environment. # # In my case, I have a gulp default task to create a build gulp echo "\n 2 - Creating repository...\n" cd ci git clone $REPO $BUILD_DIR cd $BUILD_DIR echo "\n 3 - Building...\n" echo "Removing old files" # I remove this files because I only keep in git my theme and my # "core plugin". You should remove everyting you need to make sure # only the modified and the new files will be added on new commit. rm -rf wp-content # Creating my structure: change as you need. mkdir --parents wp-content/themes mkdir --parents wp-content/plugins echo "Copying new files" # As I said before, I'm coping back my files. cp -r ../../www/wp-content/themes/example wp-content/themes cp -r ../../www/wp-content/plugins/example-core wp-content/plugins echo "Removing source" # Here I remove the directories I do not want to send to WPENGINE. # You can change this using a (different) gitignore. rm -r wp-content/themes/example/source echo "\n 4 - Pushing...\n" # Now you add everyting. # The unchanged files will not be a problem because we added it back. # # The commit message will container the current date and time git add --all > /dev/null git commit -m "DEPLOYMENT $(date +'%Y%m%d-%H%M')" > /dev/null git push $REPO master echo "\n 5 - Cleaning build\n" # Returning to root # Remember to change it if you are not using my structure # cd ../../.. # rm -rf ci/build echo "\nFinished"