Viewing formatted code. Want to see the raw file?
#!/bin/bash
owner=$(printenv REPL_OWNER)
slug=$(printenv REPL_SLUG)
echo -e "\n===== Uploading: $owner/$slug =====\n"
# this is also enforced on the server, btw
if [[ ! -f ./index.html ]]; then
echo "You don't appear to have an index.html file here. ByteForge only supports static sites."
exit 1
fi
# zip the current code
echo -e "> Zipping Files...\n"
# run zip from nix
nix-shell -p zip --run "zip -r repl_code.zip ./ > /dev/null 2>&1"
# upload to the server
echo -e "> Uploading...\n"
#upload to ByteForge server
curl \
-X POST \
-F "code=@./repl_code.zip" \
-F "owner=$owner" \
-F "project=$slug" \
https://DOMAIN/upload \
> /dev/null 2>&1
#clean up
echo -e "> Cleaning Up...\n"
rm repl_code.zip
echo -e "Done!\nhttps://DOMAIN/$owner/$slug/"