Skip to content

Instantly share code, notes, and snippets.

@ajmas
Last active April 15, 2020 18:17
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 ajmas/b31f914a70ec32a12a3c8779d667f0cd to your computer and use it in GitHub Desktop.
Save ajmas/b31f914a70ec32a12a3c8779d667f0cd to your computer and use it in GitHub Desktop.
Deployment Script
#!/bin/sh
project=myapp
repo_path=~/repositories/${project}
dist_path=~/repositories/${project}
deploy_dir=/usr/local/${project}
export env=prod
cd "${repo_path}"
git checkout .
git checkout prod
git pull
git_branch=`git branch | grep \* | cut -d ' ' -f2`
git_hash=`git rev-parse HEAD`
## This should probably be done as part of the CI and have a release tarball available
npm install
scripts/generate-appinfo.sh "${git_branch}" "${git_hash}" src/appinfo.json
npm run build
npm install --production
rsync --exclude="/.*" --exclude=test_data \
-avh "${dist_path}/" "${deploy_dir}" --delete
cd "${deploy_dir}"
./scripts/nodectl.sh restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment