Compare commits
No commits in common. "ac4f568feb8165ca0c839b9c6f252faf563e5099" and "1b91439dfbf1cb2bed1641c6efbb1e393bb2fca9" have entirely different histories.
ac4f568feb
...
1b91439dfb
@ -1,41 +1,18 @@
|
|||||||
#!/bin/bash -eE
|
#!/bin/bash -e
|
||||||
|
|
||||||
exec 100> $HOME/homepage.lock
|
exec 100> $HOME/homepage.lock
|
||||||
|
|
||||||
flock 100
|
flock 100
|
||||||
|
|
||||||
log=$(mktemp)
|
|
||||||
|
|
||||||
catch_err () {
|
|
||||||
(
|
|
||||||
echo "An error occured during building"
|
|
||||||
echo ""
|
|
||||||
cat "$log"
|
|
||||||
) >&12
|
|
||||||
}
|
|
||||||
|
|
||||||
catch_exit() {
|
|
||||||
rm -f "$log"
|
|
||||||
}
|
|
||||||
|
|
||||||
trap catch_err ERR
|
|
||||||
trap catch_exit EXIT
|
|
||||||
|
|
||||||
src=/srv/data/tsc-cloud/homepage/hugo-page
|
src=/srv/data/tsc-cloud/homepage/hugo-page
|
||||||
dst=/srv/http/tsc/hugo
|
dst=/srv/http/tsc/hugo
|
||||||
prod=/srv/data/tsc-cloud/homepage/production
|
prod=/srv/data/tsc-cloud/homepage/production
|
||||||
|
|
||||||
if [ -n "$SSH_ORIGINAL_COMMAND" ]
|
|
||||||
then
|
|
||||||
cmd="$SSH_ORIGINAL_COMMAND"
|
cmd="$SSH_ORIGINAL_COMMAND"
|
||||||
else
|
|
||||||
cmd="$@"
|
|
||||||
fi
|
|
||||||
# echo "$cmd"
|
# echo "$cmd"
|
||||||
|
|
||||||
publishToStage=
|
publishToStage=
|
||||||
publishToProduction=y
|
publishToProduction=y
|
||||||
verboseLogs=n
|
|
||||||
|
|
||||||
branch=develop
|
branch=develop
|
||||||
|
|
||||||
@ -57,9 +34,6 @@ parseCMD() {
|
|||||||
--debug)
|
--debug)
|
||||||
set -x
|
set -x
|
||||||
;;
|
;;
|
||||||
--verbose|-v)
|
|
||||||
verboseLogs=y
|
|
||||||
;;
|
|
||||||
*)
|
*)
|
||||||
echo "Unknown command $part"
|
echo "Unknown command $part"
|
||||||
exit 1
|
exit 1
|
||||||
@ -69,11 +43,6 @@ parseCMD() {
|
|||||||
}
|
}
|
||||||
parseCMD $cmd
|
parseCMD $cmd
|
||||||
|
|
||||||
if [ "$verboseLogs" = "n" ]
|
|
||||||
then
|
|
||||||
exec 11>&1 12>&2 > "$log" 2>&1
|
|
||||||
fi
|
|
||||||
|
|
||||||
doPublishToStage() {
|
doPublishToStage() {
|
||||||
rsync -ah --delete --delete-delay public/ "$dst/"
|
rsync -ah --delete --delete-delay public/ "$dst/"
|
||||||
}
|
}
|
||||||
@ -118,13 +87,13 @@ echo "Synchronizing files to web server"
|
|||||||
if [ -n "$publishToStage" ]
|
if [ -n "$publishToStage" ]
|
||||||
then
|
then
|
||||||
echo "Pushing to stage"
|
echo "Pushing to stage"
|
||||||
( time doPublishToStage )
|
time doPublishToStage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$publishToProduction" ]
|
if [ -n "$publishToProduction" ]
|
||||||
then
|
then
|
||||||
echo "Publishing to production server"
|
echo "Publishing to production server"
|
||||||
( time doPublishToProduction )
|
time doPublishToProduction
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Deployment done"
|
echo "Deployment done"
|
||||||
|
Loading…
Reference in New Issue
Block a user