Created
August 24, 2019 17:50
-
-
Save jamesfacts/09746e244562658b90698f7d0c1aeb4c to your computer and use it in GitHub Desktop.
Circle CI deploy script
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 | |
# don't continue to execute if we encounter an error | |
# https://stackoverflow.com/questions/19622198/what-does-set-e-mean-in-a-bash-script | |
set -e | |
# prevent ssh from raising interactive prompt for new host keys | |
echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config | |
WPE_ENVIRONMENT=production | |
if [ "master" == "${CIRCLE_BRANCH}" ]; then | |
WPE_INSTALL=${WPE_LIVE} | |
elif [ "staging" == "${CIRCLE_BRANCH}" ]; then | |
WPE_INSTALL=${WPE_STAGING} | |
else | |
WPE_INSTALL=${WPE_DEV} | |
fi | |
rm .gitignore | |
rm -rf .git | |
mv .gitignore_deploy ~/.gitignore | |
cd ~ | |
git config --global user.email "circleci@${WPE_INSTALL}.com" | |
git config --global user.name "${CIRCLE_USERNAME} ${CIRCLE_PROJECT_REPONAME}" | |
git init | |
git remote add origin [email protected]:${WPE_ENVIRONMENT}/${WPE_INSTALL}.git | |
git add . | |
git status | |
git commit -m "Deployment Commit" | |
git push origin master --force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment