...
This commit is contained in:
56
build.sh
56
build.sh
@@ -1,34 +1,33 @@
|
||||
PREFIX="mycelium"
|
||||
|
||||
echo "Starting build..."
|
||||
|
||||
SOURCE=${BASH_SOURCE[0]}
|
||||
DIR_OF_THIS_SCRIPT="$( dirname "$SOURCE" )"
|
||||
ABS_DIR_OF_SCRIPT="$( realpath $DIR_OF_THIS_SCRIPT )"
|
||||
|
||||
# TODO: Check if current version is latest to avoid redundant installation
|
||||
if [[ -f "tailwindcss" ]]
|
||||
then
|
||||
rm tailwindcss
|
||||
fi
|
||||
# Check if tailwindcss executable exists, if not, download and install it
|
||||
if [[ ! -f "tailwindcss" ]]; then
|
||||
echo "Installing & building tailwind..."
|
||||
ASSET="tailwindcss"
|
||||
|
||||
# checks os and architecture for correct release
|
||||
# https://stackoverflow.com/a/8597411
|
||||
echo "Installing & building tailwind..."
|
||||
ASSET="tailwindcss"
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
ASSET="$ASSET-linux"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
ASSET="$ASSET-macos"
|
||||
fi
|
||||
if [[ "$(uname -m)" == "x86_64"* ]]; then
|
||||
ASSET="$ASSET-x64"
|
||||
elif [[ "$(uname -m)" == "arm64"* ]]; then
|
||||
ASSET="$ASSET-arm64"
|
||||
fi
|
||||
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
ASSET="$ASSET-linux"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
ASSET="$ASSET-macos"
|
||||
curl -sLO "https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.17/${ASSET}"
|
||||
chmod +x $ASSET
|
||||
mv $ASSET tailwindcss
|
||||
else
|
||||
echo "tailwindcss already exists, skipping installation."
|
||||
fi
|
||||
if [[ "$(uname -m)" == "x86_64"* ]]; then
|
||||
ASSET="$ASSET-x64"
|
||||
elif [[ "$(uname -m)" == "arm64"* ]]; then
|
||||
ASSET="$ASSET-arm64"
|
||||
fi
|
||||
|
||||
curl -sLO "https://github.com/tailwindlabs/tailwindcss/releases/download/v3.4.17/${ASSET}"
|
||||
chmod +x $ASSET
|
||||
mv $ASSET tailwindcss
|
||||
|
||||
|
||||
# initialized and configures tailwind if not configured
|
||||
@@ -43,6 +42,15 @@ fi
|
||||
echo "Compiling tailwindcss and building zola project..."
|
||||
rm -rf public static/css
|
||||
./tailwindcss -i css/index.css -o ./static/css/index.css --minify
|
||||
zola --root $ABS_DIR_OF_SCRIPT build
|
||||
|
||||
rsync -rav --delete public/ ${HOME}/hero/var/www/mycelium/
|
||||
|
||||
# echo "Building without prefix..."
|
||||
# sed 's|base_url = "BASEURL"|base_url = "https://www.mycelium.threefold.io/"|' config.templ.toml > config.toml
|
||||
# zola --root $ABS_DIR_OF_SCRIPT build
|
||||
# rsync -avz --delete public/ "root@threefold.info:/root/hero/www/info/$PREFIX/"
|
||||
|
||||
echo "Building with prefix: /$PREFIX/"
|
||||
sed 's|base_url = "BASEURL"|base_url = "/mycelium/"|' config.templ.toml > config.toml
|
||||
zola --root $ABS_DIR_OF_SCRIPT build
|
||||
rsync -rav --delete public/ "${HOME}/hero/var/www/$PREFIX/"
|
||||
rsync -avz --delete public/ "root@threefold.info:/root/hero/www/info/$PREFIX/"
|
||||
|
Reference in New Issue
Block a user