Joseph Lenox 04b59affce only decrypt if the key is available (#3858)
* only decrypt if the key is available

* Use script instead of explicit command

* Don't deploy if the keyfile is missing/empty.

* Don't deploy if key is not available.

* Don't decrypt appveyor key if no secret

* wrong name

* Fix the logic and a typo
2017-04-05 11:27:04 -05:00

21 lines
425 B
Bash
Executable File

#!/bin/bash
# Prerequisites
# Environment Variables:
# UPLOAD_USER - user to upload to sftp server
# KEY is assumed to be path to a ssh key for UPLOAD_USER
DIR=$1
shift
KEY=$1
shift
FILES=$*
if [ -s $KEY ]; then
for i in $FILES; do
filepath=$(readlink -f "$i")
echo put $filepath | sftp -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/"
done
else
echo "$KEY is not available, not deploying."
fi