Created
March 2, 2018 21:43
-
-
Save samholmes/a54d4a2392153e6ab1ae10b825381881 to your computer and use it in GitHub Desktop.
Shell script to make git deployable production environments
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
#!/bin/sh | |
NAME=$1 | |
DIR=$PWD | |
if [ ! -d "$DIR/$NAME" ]; then | |
mkdir "$NAME" | |
fi | |
if [ ! -d "$DIR/repos" ]; then | |
mkdir repos | |
fi | |
if [ ! -d "$DIR/repos/$NAME" ]; then | |
mkdir "$DIR/repos/$NAME" | |
fi | |
cd "$DIR/repos/$NAME" | |
git init --bare | |
echo "#!/bin/sh | |
export GIT_WORK_TREE=$DIR/$NAME | |
git checkout -f master | |
cd $DIR/$NAME | |
npm run prod-update" > hooks/post-update | |
chmod 755 hooks/post-update |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment