upload.sh can now do all the required media files so ci doesnt have to
This commit is contained in:
parent
799900819d
commit
31dde1140a
@ -38,11 +38,7 @@ deploy-neocities:
|
||||
# First the html
|
||||
- bash upload.sh -h
|
||||
# then we do the media files
|
||||
- for file in $(find media);do \
|
||||
if [ -f $file ];then \
|
||||
bash upload.sh -m $file \
|
||||
fi \
|
||||
done
|
||||
- bash upload.sh -M
|
||||
|
||||
|
||||
|
||||
|
15
upload.sh
15
upload.sh
@ -15,7 +15,7 @@ _upload_html() {
|
||||
for f in $@;do
|
||||
remote_path=${f:1}
|
||||
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
|
||||
}
|
||||
|
||||
@ -31,6 +31,15 @@ _upload_media() {
|
||||
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() {
|
||||
# Total reupload of the site's html
|
||||
_upload_html $(find -name '*.html')
|
||||
@ -61,6 +70,7 @@ Options:
|
||||
f [FOLDER] => Upload all html in [FOLDER]
|
||||
s [PATH] => Upload single html page with mirrord path
|
||||
m [PATH] => Upload any amount of media files
|
||||
M => Upload all available media
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -68,7 +78,7 @@ if [ -z $1 ];then
|
||||
_help
|
||||
else
|
||||
pushd $site > /dev/null
|
||||
while getopts ':Hhrf:s:m:' opt;do
|
||||
while getopts ':Hhrf:s:m:M' opt;do
|
||||
case $opt in
|
||||
H) _help;;
|
||||
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
|
||||
s) _upload_html $2;;# upload single html page
|
||||
m) _upload_media $2;;# upload raw file
|
||||
M) _upload_all_media;;
|
||||
esac
|
||||
done
|
||||
popd > /dev/null
|
||||
|
Loading…
Reference in New Issue
Block a user