Created
November 30, 2017 00:15
-
-
Save simesy/7aac7eaecd95a4671fd3abf823bd3ce2 to your computer and use it in GitHub Desktop.
Deploy to acquia with robo-git-artefact
This file contains 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 characters
#!/usr/bin/env bash | |
# An un-abstracted example of deploying to Acquia's git. | |
# Assumes your project lives in github or something and you want to | |
# deploy code to Acquia. | |
# | |
# Assumes you have a ~/.acquia/cloudapi.conf etc. In other words, if you can | |
# `git clone` the Acquia repo, and push to it, and run drush commands on | |
# the Acquia site, then this script will work. | |
# | |
# Assumes you have added `integratedexperts/robo-git-artefact` into your | |
# composer project. | |
ACQUIA_REMOTE="worksafe@svn-12345.prod.hosting.acquia.com:coolsite.git" | |
ACQUIA_REMOTE_BRANCH=master | |
BUILD_PATH="/tmp/coolsite" | |
PROJECT_PATH=`pwd` | |
REMOTE_ALIAS="@coolsite.dev" | |
# Copy the project directory to a build location. | |
mkdir -p $BUILD_PATH | |
rm -Rf $BUILD_PATH/.git # Workaround to fix https://github.com/integratedexperts/robo-git-artefact/issues/17 | |
rsync -rtl --include ".*" "$PROJECT_PATH"/ "$BUILD_PATH"/ | |
cd $BUILD_PATH | |
# Use integratedexperts/robo-git-artefact to force push the code to Acquia. | |
./vendor/bin/robo --ansi \ | |
--load-from $BUILD_PATH/vendor/integratedexperts/robo-git-artefact/RoboFile.php \ | |
artefact $ACQUIA_REMOTE --branch=$ACQUIA_REMOTE_BRANCH \ | |
--push --mode=force-push \ | |
--message "Deploy [branch]" \ | |
--gitignore=.gitignore.artefact \ | |
--no-cleanup | |
# Run updates and revert config. This assumes the alias we are | |
# using matches the branch we are pushing to. | |
cd "$PROJECT_PATH" | |
./vendor/bin/drush $REMOTE_ALIAS cim -y | |
./vendor/bin/drush $REMOTE_ALIAS updb -y | |
./vendor/bin/drush $REMOTE_ALIAS cr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment