Skip to content

Instantly share code, notes, and snippets.

@markorapaic
Forked from jamesfacts/deploy
Created June 8, 2020 13:26
Show Gist options
  • Save markorapaic/fc72260a54500127f46d5ba99d1e6a64 to your computer and use it in GitHub Desktop.
Save markorapaic/fc72260a54500127f46d5ba99d1e6a64 to your computer and use it in GitHub Desktop.
FOLDER=wp-content/themes/
if [ "production" == "${CI_ENVIRONMENT_NAME}" ]; then
WPE_INSTALL=prod_install
elif [ "staging" == "${CI_ENVIRONMENT_NAME}" ]; then
WPE_INSTALL=staging_install
else
WPE_INSTALL=dev_install
fi
# Make a theme folder
mkdir $THEME_NAME
shopt -s extglob
mv !(${THEME_NAME}) ${THEME_NAME}
mv .editorconfig ${THEME_NAME}/.editorconfig
mv .eslintrc ${THEME_NAME}/.eslintrc
rm -rf .git
rm -rf ${THEME_NAME}/.git
rm .gitignore
rm ${THEME_NAME}/.gitignore
# build a WP install / dir structure EXACTLY like WPE from root
#####################################################################
mkdir -p $FOLDER
mv .gitignoredeploy .gitignore
mv $THEME_NAME $FOLDER
# Git config while still at WP root
#####################################################################
git config --global user.email "${WPE_INSTALL}@${WPE_INSTALL}.com"
git config --global user.name "${WPE_INSTALL}"
git init
git remote add origin [email protected]:${WPE_ENVIRONMENT}/${WPE_INSTALL}.git
ssh [email protected] info
# build theme
#####################################################################
cd wp-content/themes/${THEME_NAME}
composer install --no-ansi --no-dev --no-interaction --optimize-autoloader --no-progress
yarn
yarn build:production
cd ../../../
# push
#####################################################################
git add .
git status
git ls-tree -r master --name-only
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