Joseph Lenox b3cac9d0fb
Cleanup old branch builds (#4680)
* #4620

Invalidate posDetectSurfaces during make_perimeters() when posSlice would also get invalidated.
Can't use invalidate_step() as that invalidates the perimeters as well.

* Add a test step to check for regression #4620 - behavior on running Print::process() again on the same model.

* Fix naming scheme for macos/osx builds to make it obvious if it is a PR or not.

* Remove previous versions of the same kind of branch or PR ID

* Adjust copied statements to account for different calling conventions; osx does not have an arch name argument for make_dmg

* Remember to set the version too

* Update windows build server command to clean up old branch builds.

* Specifically look for PR${PR_ID} instead of just ${PR_ID} to avoid unintentional deletions.

* don't symlink pull requests

* Update to call more functions on osx

* Only delete/clean once, not once per file uploaded.
2019-01-06 13:53:41 -06:00

45 lines
1.2 KiB
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=$*
source $(dirname $0)/../common/util.sh
set_pr_id
set_branch
if [ ! -z ${PR_ID+x} ] || [ $current_branch != "master" ]; then
DIR=${DIR}/branches
fi
if [ -s $KEY ]; then
if [ ! -z ${PR_ID+x} ] || [ $current_branch != "master" ]; then
# clean up old copies of the same branch/PR
if [ ! -z ${PR_ID+x} ]; then
echo "rm *PR${PR_ID}*" | sftp -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/"
fi
if [ $current_branch != "master" ]; then
echo "rm *${current_branch}*" | sftp -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/"
fi
fi
for i in $FILES; do
filepath=$i # this is expected to be an absolute path
tmpfile=$(mktemp)
echo put $filepath > $tmpfile
sftp -b $tmpfile -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/"
result=$?
if [ $? -eq 1 ]; then
echo "Error with SFTP"
exit $result;
fi
done
else
echo "$KEY is not available, not deploying."
fi
exit $result