mirror of
https://github.com/qurator-spk/eynollah.git
synced 2026-07-26 05:29:16 +02:00
model packaging/uploading
This commit is contained in:
parent
83fca95914
commit
1972e9975b
6 changed files with 310 additions and 0 deletions
59
models/scripts/zenodo_upload.sh
Executable file
59
models/scripts/zenodo_upload.sh
Executable file
|
|
@ -0,0 +1,59 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Upload big files to Zenodo.
|
||||
#
|
||||
# usage: ./zenodo_upload.sh [deposition id] [filename] [--verbose|-v]
|
||||
#
|
||||
# Taken from https://github.com/jhpoelen/zenodo-upload
|
||||
#
|
||||
# Copyright (c) 2019 Jorrit Poelen
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
|
||||
set -xe
|
||||
|
||||
VERBOSE=0
|
||||
if [ "$3" == "--verbose" ] || [ "$3" == "-v" ]; then
|
||||
VERBOSE=1
|
||||
fi
|
||||
|
||||
# strip deposition url prefix if provided; see https://github.com/jhpoelen/zenodo-upload/issues/2#issuecomment-797657717
|
||||
DEPOSITION=$( echo $1 | sed 's+^http[s]*://zenodo.org/deposit/++g' )
|
||||
FILEPATH="$2"
|
||||
FILENAME=$(echo $FILEPATH | sed 's+.*/++g')
|
||||
FILENAME=${FILENAME// /%20}
|
||||
ZENODO_ENDPOINT=${ZENODO_ENDPOINT:-https://zenodo.org}
|
||||
|
||||
BUCKET=$(curl ${ZENODO_ENDPOINT}/api/deposit/depositions/"$DEPOSITION"?access_token="$ZENODO_TOKEN" | jq --raw-output .links.bucket)
|
||||
|
||||
if [ "$VERBOSE" -eq 1 ]; then
|
||||
echo "Deposition ID: $DEPOSITION"
|
||||
echo "File path: $FILEPATH"
|
||||
echo "File name: $FILENAME"
|
||||
echo "Bucket URL: $BUCKET"
|
||||
echo "Uploading file..."
|
||||
fi
|
||||
|
||||
curl --progress-bar \
|
||||
--retry 5 \
|
||||
--retry-delay 5 \
|
||||
-o /dev/null \
|
||||
--upload-file "$FILEPATH" \
|
||||
$BUCKET/"$FILENAME"?access_token="$ZENODO_TOKEN"
|
||||
Loading…
Add table
Add a link
Reference in a new issue