Closed Poikilos closed 3 months ago
The install folder is modified, so it is necessary for if there were disaster recovery. What I did was use "rsync" from the repo to the html folder on my local machine. Maybe make that does both, something like:
deploy-www.sh
#!/bin/bash
#WWW_DATA=/var/www/html
# ^ Uncomment & change value before running this script (must *not* end in slash).
#REPO=~/git/rpgdx
# ^ Uncomment & change value before running this script (must *not* end in slash).
if [ -z "$REPO" ]; then
echo "Error: Set REPO. See comments in this script."
exit 1
fi
cd $REPO || exit 1
git pull || exit 1
if [ -z "$WWW_DATA" ]; then
echo "Error: Set WWW_DATA. See comments in this script."
exit 1
fi
rsync -rt --exclude=".*" --exclude "readme.md" --exclude "development.md" --exclude "install" ./ $WWW_DATA
# ^ slash in 1st arg (not 2nd arg) is important so this dir doesn't become a sub-subfolder in dest.
cd $WWW_DATA || exit 2
if [ -d .git ]; then
rm -rf .git
rm .gitignore
rm development.md
rm readme.md
fi
if [ -d install ]; then
rm -rf install
fi
@Poikilos Thanks! I've set it up very similar, making the git repository no longer "bare" and using the following post-receive
hook:
#!/bin/bash
REPO="/home/private/rpgdx"
WWW_DATA="/home/public"
cd $REPO || exit 1
echo "Synchronizing website at $WWW_DATA"
rsync -rtv \
--exclude=".*" \
--exclude "*.md" \
--exclude "HOSTED" \
--exclude "TODO" \
--exclude "rpgdx.code-workspace" \
--exclude "sql" \
--exclude "install" \
./ $WWW_DATA
echo "Website deployed!"
-@bjorn https://github.com/bjorn/rpgdx/pull/9#issuecomment-2125645067