Skip to content

Instantly share code, notes, and snippets.

@oriolclosa
Last active June 21, 2018 16:54
Show Gist options
  • Select an option

  • Save oriolclosa/568922b54574cb5dd64bd203304523ee to your computer and use it in GitHub Desktop.

Select an option

Save oriolclosa/568922b54574cb5dd64bd203304523ee to your computer and use it in GitHub Desktop.
Autodeploy GitHub Node projects
#!/bin/bash
echo `date`" Checking for new version..." >> result-deploy.log
git pull > result-git.log
OK=`cat result-git.log | grep "Already up-to-date."`
if [[ $OK == "" ]]; then
npm run dist > result-npm.log
OK=`cat result-npm.log | grep "Success!"`
if [[ $OK != "" ]]; then
rm -rf web/testing-OLD > /dev/null 2>&1
mv web/testing web/testing-OLD > /dev/null 2>&1
mv dist web/testing > /dev/null 2>&1
echo `date`" New version deployed!" >> result-deploy.log
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment