upload.sh can now do all the required media files so ci doesnt have to

This commit is contained in:
shockrah 2021-02-08 19:49:08 -08:00
parent 799900819d
commit 31dde1140a
2 changed files with 14 additions and 7 deletions

View File

@ -38,11 +38,7 @@ deploy-neocities:
# First the html # First the html
- bash upload.sh -h - bash upload.sh -h
# then we do the media files # then we do the media files
- for file in $(find media);do \ - bash upload.sh -M
if [ -f $file ];then \
bash upload.sh -m $file \
fi \
done

View File

@ -15,7 +15,7 @@ _upload_html() {
for f in $@;do for f in $@;do
remote_path=${f:1} remote_path=${f:1}
echo curl -H "auth" -F "$remote_path=@$f" $url/api/upload echo curl -H "auth" -F "$remote_path=@$f" $url/api/upload
curl -H "$auth" -F "$remote_path=@$f" $url/api/upload curl -H "$auth" -F "$remote_path=@$f" $url/api/upload > /dev/null
done done
} }
@ -31,6 +31,15 @@ _upload_media() {
done done
} }
_upload_all_media() {
for file in $(find media);do
echo Uploading media: $file
if [ -f $file ];then
curl -H "$auth" -F "$file=@$file" $url/api/upload > /dev/null
fi
done
}
html() { html() {
# Total reupload of the site's html # Total reupload of the site's html
_upload_html $(find -name '*.html') _upload_html $(find -name '*.html')
@ -61,6 +70,7 @@ Options:
f [FOLDER] => Upload all html in [FOLDER] f [FOLDER] => Upload all html in [FOLDER]
s [PATH] => Upload single html page with mirrord path s [PATH] => Upload single html page with mirrord path
m [PATH] => Upload any amount of media files m [PATH] => Upload any amount of media files
M => Upload all available media
EOF EOF
} }
@ -68,7 +78,7 @@ if [ -z $1 ];then
_help _help
else else
pushd $site > /dev/null pushd $site > /dev/null
while getopts ':Hhrf:s:m:' opt;do while getopts ':Hhrf:s:m:M' opt;do
case $opt in case $opt in
H) _help;; H) _help;;
h) _upload_html $(find -name '*.html');; # Upload all html content h) _upload_html $(find -name '*.html');; # Upload all html content
@ -76,6 +86,7 @@ else
f) _upload_html $2/*.html;;# Upload html in the spec'd folder f) _upload_html $2/*.html;;# Upload html in the spec'd folder
s) _upload_html $2;;# upload single html page s) _upload_html $2;;# upload single html page
m) _upload_media $2;;# upload raw file m) _upload_media $2;;# upload raw file
M) _upload_all_media;;
esac esac
done done
popd > /dev/null popd > /dev/null