Skip to content

Instantly share code, notes, and snippets.

@worldwise001
Last active May 10, 2020 05:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save worldwise001/a76c9717d988441cba2c004cfa5df93d to your computer and use it in GitHub Desktop.
Save worldwise001/a76c9717d988441cba2c004cfa5df93d to your computer and use it in GitHub Desktop.
artifact "build" + "deploy" script
#!/bin/bash
if [[ "$1" = "" ]]; then
echo "need to specify app as argument"
exit 1
fi
app="$1"
pushd /srv/http
git clone https://YOUR_GITHUB_HERE/$app.git ${app}_latest
pushd /srv/http/${app}_latest
latest=`git rev-parse HEAD`
popd
if [[ ! -d "/srv/http/${app}_${latest}" ]]; then
mv ${app}_latest ${app}_${latest}
pushd ${app}_${latest}
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python setup.py install
deactivate
pushd webapp
npm install
npm run build
popd
popd
rm /srv/http/$app
ln -s /srv/http/${app}_${latest} /srv/http/$app
else
rm -r /srv/${app}_latest
fi
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment