-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1
56 lines (43 loc) · 1.23 KB
/
1
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
set -e
commit_msg="deployment"
for ARG in "$@"
do
KEY=$(echo $ARG | cut -f1 -d=)
VALUE=$(echo $ARG | cut -f2 -d=)
case "$KEY" in
--app-name) app_name=${VALUE} ;;
--repo-branch) repo_branch=${VALUE} ;;
*)
esac
done
validate_arg(){
if [ -z "$1" ]; then
echo "Not all arguments provided; check that --app-name= and --repo-branch= are there!"
echo "Aborting scripts.."
exit 1
fi
}
echo "App Name is : $app_name"
echo "Branch Name is : $repo_branch"
validate_arg $app_name
validate_arg $repo_branch
echo -e "-->Starting Deployment on Heroku for $app_name<--"
#Move to the compiled folder, move a package.json that contains the npm start script
echo -e "\n-->Moving to the app folder<--"
cp package_deploy.json dist/package.json
cd dist
#Initialize Git
echo -e "\n-->Initializing Heroku git on specific folder<--"
git init
#Add remote Heroku url of your app
echo -e "\n-->Adding Heroku remote url<--"
../node_modules/heroku-cli/bin/run git:remote -a $app_name
#Add npm start to the package json file (npm start)
## missing
echo -e "\n-->Committing local files<--"
#Commit files
git add .
git commit -m $commit_msg
echo -e "\n-->Deploying the project on Heroku<--"
#Push and deploy
git push heroku $repo_branch --force