Bugfix: Actually get the really right reminder this time....hopefully
continuous-integration/laminar-elessar Build 29 succeeded in 1 minute 4 seconds . Details

Also add continuous deployment! :D :D :D
This commit is contained in:
Starbeamrainbowlabs 2019-03-28 19:27:54 +00:00
parent b7f3f27042
commit 23fb6cf820
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
2 changed files with 50 additions and 7 deletions

View File

@ -41,7 +41,7 @@ namespace RhinoReminds
if (Reminders.Count == 0)
return null;
return Reminders.Max;
return Reminders.Min;
}
public Reminder GetById(int targetId) {

55
build
View File

@ -18,6 +18,11 @@ 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";
deploy_target_dir="RhinoReminds";
###############################################################################
# Check out the lantern git submodule if needed
@ -49,7 +54,7 @@ fi
###############################################################################
function task_setup {
task_setup() {
task_begin "Checking environment";
check_command git true;
@ -61,7 +66,7 @@ function task_setup {
task_end 0;
}
function task_build {
task_build() {
task_begin "Restoring nuget packages";
nuget restore;
task_end $?;
@ -97,7 +102,7 @@ function task_build {
task_end $?;
}
function task_archive {
task_archive() {
task_begin "Deleting extra files";
execute find RhinoReminds/bin -iname "*.xml" -delete;
task_end $?;
@ -128,7 +133,7 @@ function task_archive {
fi
}
function task_package {
task_package() {
task_begin "Preparing for packaging";
check_command fpm true;
@ -140,7 +145,44 @@ function task_package {
task_end $?;
}
function task_ci {
task_deploy() {
stage_begin "Deploying to ${deploy_ssh_host}....";
if [ "${SSH_KEY_PATH}" == "" ]; then
stage_end 1 "Error: Can't find the SSH key as the environment variable SSH_KEY_PATH isn't set.";
fi
task_begin "Preparing upload";
subtask_begin "Creating temporary directory";
temp_dir="$(mktemp -d --suffix "-rhinoreminds-upload")";
subtask_end $? "Error: Failed to create temporary directory";
subtask_begin "Unpacking release files";
execute tar -xf "${ARCHIVE}/RhinoReminds-Release.tar.gz" -C "${temp_dir}";
subtask_end $? "Failed to unpack release files";
# Define the directory whose contents we want to upload
source_upload_dir="${temp_dir}/RhinoReminds-Release";
task_end $?;
task_begin "Uploading release";
# TODO: If we experience issues, we need to somehow figure out how to recursively delete the contents of the directory before uploading. We may have to install lftp and use that instead
sftp -i "${SSH_KEY_PATH}" -P "${deploy_ssh_port}" -o PasswordAuthentication=no "${deploy_ssh_user}@${deploy_ssh_host}" << SFTPCOMMANDS
rm ${deploy_target_dir}/*
put -r ${source_upload_dir}/* ${deploy_target_dir}
bye
SFTPCOMMANDS
task_end $? "Failed to upload release";
task_begin "Cleaning up";
execute rm -r "${temp_dir}";
task_end $?;
stage_end $? "Failed to deploy to ${deploy_ssh_host}.";
}
task_ci() {
tasks_run setup;
task_begin "Environment Information";
@ -150,7 +192,8 @@ function task_ci {
execute nuget help | head -n1;
task_end 0;
tasks_run build archive;
# FUTURE: We'll (eventually) want to call the package task here too
tasks_run build archive deploy;
}