Improve deploy/reverting

This commit is contained in:
Jordan Eldredge 2017-08-17 21:16:16 -07:00
parent 9435bde20b
commit 21626270be
4 changed files with 24 additions and 7 deletions

View file

@ -31,6 +31,15 @@ Open `index.html` in your browser.
Open `http://localhost:8080/webpack-dev-server/` in your browser.
## Deploying
npm run deploy
## Reverting
npm run revert # Reverts quickly to the previous deploy
HASH=<SOME_GIT_HASH> npm run deploy # Runs a new deploy at a given hashlike.
## Reference
- [skinspecs.pdf](http://members.xoom.it/skinart/tutorial/skinspecs..pdf)

View file

@ -9,20 +9,27 @@ cd /var/www/jordaneldredge.com/
NEW_CLONE=repos/winamp2-js-`date +%s`
# Do the clone
echo "Cloning Winamp2-js"
git clone git@github.com:captbaritone/winamp2-js.git $NEW_CLONE > /dev/null
echo "Cloning Winamp2-js..."
if [ -z "$HASH" ]; then
echo "Using master"
git clone --depth=1 git@github.com:captbaritone/winamp2-js.git $NEW_CLONE > /dev/null
else
git clone git@github.com:captbaritone/winamp2-js.git $NEW_CLONE > /dev/null
echo "Checking out hash $HASH"
( cd $NEW_CLONE && git checkout --quiet $HASH )
fi
echo "Installing Node requirements"
( cd $NEW_CLONE && yarn install)
( cd $NEW_CLONE && yarn install )
echo "Run tests"
( cd $NEW_CLONE && yarn run test )
echo "Build the webpack bundle"
( cd $NEW_CLONE && yarn run build)
( cd $NEW_CLONE && yarn run build )
echo "Cleaning up node_modules/ to save space"
( cd $NEW_CLONE && rm -r node_modules)
( cd $NEW_CLONE && rm -r node_modules )
PREVIOUS=$(readlink -f public_html/projects/winamp2-js)

View file

@ -11,7 +11,7 @@
"test": "jest --coverage",
"travis-tests": "jest --coverage && npm run lint && npm run build",
"tdd": "jest --watch",
"deploy": "ssh jordaneldredge.com sh < deploy.sh",
"deploy": "ssh jordaneldredge.com HASH=$HASH sh < deploy.sh",
"revert": "ssh jordaneldredge.com sh < revert.sh",
"format": "prettier --write js/**/*.js css/**/*.css webpack.config.js webpack.production.config.js"
},

View file

@ -7,7 +7,8 @@ echo "Reverting..."
cd /var/www/jordaneldredge.com/
PREVIOUS=$(readlink -f repos/previous)
echo "Rolling back to $PREVIOUS"
ln -snf `pwd`repos/previous public_html/projects/winamp2-js
ln -snf $PREVIOUS public_html/projects/winamp2-js
echo "Done!"