From 31dde1140a45879c822d7ddb1dd93f31ecd48f95 Mon Sep 17 00:00:00 2001 From: shockrah Date: Mon, 8 Feb 2021 19:49:08 -0800 Subject: [PATCH] upload.sh can now do all the required media files so ci doesnt have to --- .gitlab-ci.yml | 6 +----- upload.sh | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6c07a2b..5435bb9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/upload.sh b/upload.sh index 838882c..7e47e64 100755 --- a/upload.sh +++ b/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