From c7e3e7f22c2631466851cf7e60f166c413304971 Mon Sep 17 00:00:00 2001 From: Joseph Lenox Date: Sat, 24 Feb 2018 19:01:48 -0600 Subject: [PATCH] Update travis to create a "latest" symlink. --- .travis.yml | 2 ++ package/deploy/sftp-symlink.sh | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 package/deploy/sftp-symlink.sh diff --git a/.travis.yml b/.travis.yml index 27d12bbe1..3fb61d34e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,8 @@ after_success: - LD_LIBRARY_PATH=$WXDIR/lib package/linux/make_archive.sh linux-x64 - package/linux/appimage.sh x86_64 - package/deploy/sftp.sh linux ~/slic3r-upload.rsa *.bz2 Slic3r*.AppImage +- package/deploy/sftp-symlink.sh linux ~/slic3r-upload.rsa AppImage Slic3r*.AppImage +- package/deploy/sftp-symlink.sh linux ~/slic3r-upload.rsa bz2 *.bz2 branches: only: - master diff --git a/package/deploy/sftp-symlink.sh b/package/deploy/sftp-symlink.sh new file mode 100644 index 000000000..15161d5a7 --- /dev/null +++ b/package/deploy/sftp-symlink.sh @@ -0,0 +1,38 @@ +#!/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 +EXT=$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 + for i in $FILES; do + filepath=$(readlink -f "$i") + tmpfile=$(mktemp) + echo "rm -f slic3r-${current_branch}-latest.${EXT}" > $tmpfile + echo "symlink slic3r-${current_branch}-latest.${EXT} $filepath" >> $tmpfile + sftp -b $tmpfile -i$KEY "${UPLOAD_USER}@dl.slic3r.org:$DIR/" + result=$? + if [ $? -eq 1 ]; then + echo "Error with SFTP symlink" + exit $result; + fi + done +else + echo "$KEY is not available, not symlinking." +fi +exit $result