256bd2336f
* Tweaks and backend vscode settings * Version bump * Updated Icon to be more vibrant * New logo and new login screen layout, version bump * New documentation! * Use CI to update package versions because I was sick of changing it everywhere * Generate docs * Docs upload * Fix pipeline * Fix pipeline * Update readme version before generating docs * Testing docs deploy * Fix pipeline * Updated CI link * Fix docs upload * Docs upload fixes * Fix s3 upload grrr * Docs tweaks * Updated readme * Updated screenshots Co-authored-by: Jamie Curnow <jamiec@benon.com>
56 lines
1.5 KiB
Bash
Executable File
56 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
||
|
||
# Note: This script is designed to be run inside CI builds
|
||
|
||
CYAN='\E[1;36m'
|
||
YELLOW='\E[1;33m'
|
||
BLUE='\E[1;34m'
|
||
GREEN='\E[1;32m'
|
||
RESET='\E[0m'
|
||
|
||
echo -e "${BLUE}❯ ${CYAN}Uploading docs in: ${YELLOW}$1${RESET}"
|
||
|
||
cd "$1" || exit 1
|
||
ALL_FILES=$(find . -follow)
|
||
|
||
for FILE in $ALL_FILES
|
||
do
|
||
# remove preceeding ./
|
||
FILE=$(echo "$FILE" | sed -E "s/\.\///g")
|
||
echo '======================================='
|
||
echo "FILE: $FILE"
|
||
|
||
if [[ -d $FILE ]]; then
|
||
echo "Skipping $FILE because it's a directory"
|
||
elif [[ -f $FILE ]]; then
|
||
PARAM_STRING="--guess-mime-type"
|
||
EXT="${FILE##*.}"
|
||
if [ "$EXT" == "css" ]; then
|
||
PARAM_STRING="-mtext/css"
|
||
elif [ "$EXT" == "js" ]; then
|
||
PARAM_STRING="-mapplication/javascript"
|
||
elif [[ "$EXT" == "html" ]]; then
|
||
PARAM_STRING="-mtext/html"
|
||
elif [[ "$EXT" == "png" ]]; then
|
||
PARAM_STRING="-mimage/png"
|
||
elif [[ "$EXT" == "jpg" ]]; then
|
||
PARAM_STRING="-mimage/jpg"
|
||
elif [[ "$EXT" == "svg" ]]; then
|
||
PARAM_STRING="-mimage/svg+xml"
|
||
fi
|
||
|
||
DEST_FOLDER=$(dirname "$FILE")
|
||
if [ "$DEST_FOLDER" == "." ]; then
|
||
DEST_FOLDER=
|
||
else
|
||
DEST_FOLDER="${DEST_FOLDER}/"
|
||
fi
|
||
|
||
echo s3cmd -v -f -P "$PARAM_STRING" --add-header="Cache-Control:public,max-age=604800" sync "$FILE" "s3://$S3_BUCKET/$DEST_FOLDER"
|
||
s3cmd -v -f -P "$PARAM_STRING" --add-header="Cache-Control:public,max-age=604800" sync "$FILE" "s3://$S3_BUCKET/$DEST_FOLDER"
|
||
rc=$?; if [ $rc != 0 ]; then exit $rc; fi
|
||
fi
|
||
done
|
||
|
||
echo -e "${BLUE}❯ ${GREEN}Upload Complete${RESET}"
|