[build] Add ability to create archives automagically

This commit is contained in:
Starbeamrainbowlabs 2019-02-12 19:43:40 +00:00
parent 1f88789309
commit 1360eb9c6f
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
2 changed files with 38 additions and 2 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
*.tar.gz
*.backup *.backup
# Created by https://www.gitignore.io/api/monodevelop,visualstudio,csharp,git # Created by https://www.gitignore.io/api/monodevelop,visualstudio,csharp,git
# Edit at https://www.gitignore.io/?templates=monodevelop,visualstudio,csharp,git # Edit at https://www.gitignore.io/?templates=monodevelop,visualstudio,csharp,git

35
build
View file

@ -38,7 +38,9 @@ if [[ "$#" -lt 1 ]]; then
echo -e ""; echo -e "";
echo -e "${CSECTION}Available actions${RS}"; echo -e "${CSECTION}Available actions${RS}";
echo -e " ${CACTION}setup${RS} - Perform initial setup"; echo -e " ${CACTION}setup${RS} - Perform initial setup";
echo -e " ${CACTION}build${RS} - Restore nuget packages & compile project";
echo -e " ${CACTION}ci${RS} - Perform CI tasks"; echo -e " ${CACTION}ci${RS} - Perform CI tasks";
echo -e " ${CACTION}archive${RS} - Construct binary archives";
echo -e ""; echo -e "";
exit 1; exit 1;
@ -67,6 +69,37 @@ function task_build {
task_end $?; task_end $?;
} }
function task_archive {
task_begin "Deleting extra files";
find RhinoReminds/bin -iname "*.xml" -delete;
task_end $?;
task_begin "Setting permissions";
find RhinoReminds/bin -type f -print0 | xargs -0 -P4 chmod -x;
find RhinoReminds/bin -type f -iname "*.exe" -print0 | xargs -0 -P4 chmod +x;
task_end $?;
task_begin "Creating Archives";
cp -ral RhinoReminds/bin/Debug RhinoReminds-Debug;
cp -ral RhinoReminds/bin/Release RhinoReminds-Release;
cp -al README.md RhinoReminds-Debug;
cp -al README.md RhinoReminds-Release;
tar -caf RhinoReminds-Debug.tar.gz RhinoReminds-Debug;
tar -caf RhinoReminds-Release.tar.gz RhinoReminds-Release;
rm -r RhinoReminds-{Debug,Release};
task_end $?;
if [ "${ARCHIVE}" != "" ]; then
task_begin "CI environment detected - moving archives to specified CI archive directory";
mv RhinoReminds-{Debug,Release}.tar.gz "${ARCHIVE}";
task_end $?;
fi
}
function task_ci { function task_ci {
tasks_run setup; tasks_run setup;
@ -78,6 +111,8 @@ function task_ci {
task_end 0; task_end 0;
tasks_run build; tasks_run build;
} }