From 23cfa8dfe9fffe30424de319fc2655962d7f8e71 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 12 Mar 2019 21:01:16 +0000 Subject: [PATCH] Automatically deploy slide deck to starbeamrainbowlabs.com --- build | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/build b/build index 3cec223..1141d76 100755 --- a/build +++ b/build @@ -18,6 +18,10 @@ lantern_path="./lantern-build-engine"; # Put any custom settings here. build_output_folder="./dist"; +deploy_ssh_user="ci"; +deploy_ssh_host="starbeamrainbowlabs.com"; +deploy_ssh_port="2403"; + ############################################################################### # Check out the lantern git submodule if needed @@ -139,15 +143,30 @@ task_ci() { tasks_run setup; export NODE_ENV=production; - tasks_run main archive; + tasks_run main archive deploy; } task_archive() { task_begin "Archiving"; - mv "dist/" "Linux101/"; + mv "${build_output_folder}" "Linux101/"; tar cafv "${ARCHIVE}/slides.tar.bz2" "Linux101/"; - mv "Linux101/" "dist/"; + exit_code=$?; + mv "Linux101/" "${build_output_folder}"; + task_end "${exit_code}"; +} + +task_deploy() { + task_begin "Deploying to starbeamrainbowlabs.com...."; + if [ "${SSH_KEY_PATH}" == "" ]; then + task_end 1 "Error: Can't find the SSH key as the environment variable SSH_KEY_PATH isn't set."; + fi + + sftp -i "${SSH_KEY_PATH}" -P "${deploy_ssh_port}" -o PasswordAuthentication=no "${deploy_ssh_user}@${deploy_ssh_host}" << SFTPCOMMANDS +put -r ${build_output_folder} Linux101/; +bye; +SFTPCOMMANDS + task_end $?; }