-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·33 lines (23 loc) · 1008 Bytes
/
deploy.sh
File metadata and controls
executable file
·33 lines (23 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
#!/bin/sh
[ $# -eq 0 ] && { echo "Usage: $0 [suffix] [version]"; exit 1; }
suffix=$1
version=$2
# Update version
echo "\$( document ).ready(function(){\$('#version_text').html('Version:${version}');});" > ./html/version.js
# Commit git
git add -A
git commit -m "ict_deploy_${suffix}_${version}"
tarfileName="deploy_pkg_${suffix}_${version}.tgz"
rm -rf *.tgz
cd html
mkdir -p "../../deploy_pkgs"
tar czf "../../deploy_pkgs/$tarfileName" *
cd ../
ssh whitehel@whitehelmettech.com 'mkdir -p ~/deploy_pkgs'
scp "../deploy_pkgs/$tarfileName" "whitehel@whitehelmettech.com:~/deploy_pkgs/"
dirDestName="~/public_html/app_${suffix}_${version}"
ssh whitehel@whitehelmettech.com "mkdir -p $dirDestName; rm -rf $dirDestName/*; tar xzf ~/deploy_pkgs/$tarfileName -C $dirDestName"
linkName="~/public_html/app_${suffix}"
ssh whitehel@whitehelmettech.com "rm -rf $linkName; ln -s $dirDestName $linkName"
ssh whitehel@whitehelmettech.com "rm -rf ~/deploy_pkgs/$tarfileName"
rm -rf "../../deploy_pkgs/$tarfileName"