meta: Added scripts for building and deploying the website

This commit is contained in:
Yuki Joou 2023-05-31 19:36:05 +02:00
parent efc65a677b
commit 56b06a6a6d
2 changed files with 39 additions and 0 deletions

16
build.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/sh
set -e;
# Clean up last build
rm -r public/;
# Build the website
hugo;
# Show the public tree
echo "Build success!";
tree public/

23
deploy.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
# A script for deploying the website
# Made by sugary :3
# Adapted by yukijoou
set -e
WEBSITE_NAME='blog.kemonomimi.gay'
WEBSITES_PATH='/var/www/blog'
[ -w $WEBSITES_PATH ] || (echo 'Don`t have write permission on website root, did you forget sudo?' && exit 1);
BACKUP_DIR=$(mktemp -d)
cp -rf "$WEBSITES_PATH" $BACKUP_DIR/$WEBSITE_NAME.bak
echo "Made backup at $BACKUP_DIR"
rm -rf "$WEBSITES_PATH"
mkdir -p "$WEBSITES_PATH"
cp -rf public/* "$WEBSITES_PATH"
echo "Installed $WEBSITE_NAME at $WEBSITES_PATH"