Improve comments on the deploy script
This commit is contained in:
parent
645d8b0676
commit
e91fe4489d
19
deploy.sh
19
deploy.sh
|
@ -1,26 +1,29 @@
|
|||
#!/bin/sh
|
||||
|
||||
#SERVER INFO
|
||||
# server info
|
||||
USER=ace
|
||||
HOST=j25.webarch.net
|
||||
REMOTE_DIR=sites/ace # the directory where your web site files should go
|
||||
|
||||
#LOCAL BUILD DIRECTORY INFO
|
||||
# local build directory path
|
||||
DIR="public"
|
||||
|
||||
# clear build directory
|
||||
rm -r "$DIR"
|
||||
|
||||
# re-build website
|
||||
hugo
|
||||
|
||||
# this will delete everything on the server that's not in the local public folder
|
||||
|
||||
|
||||
# init
|
||||
# look for empty dira
|
||||
# check that build directory exists
|
||||
if [ -d "$DIR" ]
|
||||
then
|
||||
# check that build directory is not empty
|
||||
if [ "$(ls -A $DIR)" ]; then
|
||||
rsync -avz --delete public/ ${USER}@${HOST}:~/${REMOTE_DIR} && git restore --staged . && git add public && git commit -m "deployed changes to server" && echo "Changes deployed to $HOST" || echo "No changes deployed to $HOST"
|
||||
# push to public web server location
|
||||
# note: this will delete everything on the server that's not in the local build folder
|
||||
rsync -avz --delete "$DIR"/ ${USER}@${HOST}:~/${REMOTE_DIR} && git restore --staged . && git add public && git commit -m "deployed changes to server" && echo "Changes deployed to $HOST" || echo "No changes deployed to $HOST"
|
||||
else
|
||||
# if build fails restore the old build directory
|
||||
git restore "$DIR"
|
||||
fi
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue