-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdeploy.sh
More file actions
38 lines (34 loc) · 1008 Bytes
/
deploy.sh
File metadata and controls
38 lines (34 loc) · 1008 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh
#
# Description:
# Script will receive 3 Arguments (Project Name, Environment, Branch)
# Various things happening here:
# 1.) Changing to the repo directory
# 2.) Resetting the local master branch to look exactly like remote origin master branch
# 3.) Clean off any files that don't need to be there
# 4.) Pull just to be doubly sure we have all the latest changes
# 5.) Switches branch to master just to be extra sure that we are on the right
# branch and our working tree has the right files.
#
# Written by: LM
#
if [[ -n "$1" ]] ; then
PROJECT_NAME=$1
else
PROJECT_NAME="lm-blog"
fi
if [[ -n "$2" ]] ; then
BRANCH=$2
else
BRANCH="master"
fi
cd /webroot/$PROJECT_NAME
git reset --hard origin/$BRANCH
git clean -f
git pull
git checkout $BRANCH
# forever stop index.js
# NODE_ENV=production forever start index.js
echo "#-----------------------------------------------#"
echo "# Execution Completed #"
echo "#-----------------------------------------------#"