From 76b37c2ad693fbe80f65c2355228163110d70a5c Mon Sep 17 00:00:00 2001 From: Morgan Pretty Date: Wed, 2 Aug 2023 09:16:39 +1000 Subject: [PATCH] Further tweaks to CI setup Added a suffix to distinguish the output files for upload Attempting to exclude the Sim and AppStore builds from PR builds (they can't upload anyway) --- .drone.jsonnet | 2 ++ Scripts/drone-static-upload.sh | 36 +++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index e09c16edc..982308b24 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -97,6 +97,7 @@ local update_cocoapods_cache = { type: 'exec', name: 'Simulator Build', platform: { os: 'darwin', arch: 'amd64' }, + when: { event: { exclude: 'pull_request' } }, steps: [ clone_submodules, load_cocoapods_cache, @@ -124,6 +125,7 @@ local update_cocoapods_cache = { type: 'exec', name: 'AppStore Build', platform: { os: 'darwin', arch: 'amd64' }, + when: { event: { exclude: 'pull_request' } }, steps: [ clone_submodules, load_cocoapods_cache, diff --git a/Scripts/drone-static-upload.sh b/Scripts/drone-static-upload.sh index cc3225461..99a03db85 100755 --- a/Scripts/drone-static-upload.sh +++ b/Scripts/drone-static-upload.sh @@ -17,32 +17,36 @@ set -o xtrace # Don't start tracing until *after* we write the ssh key chmod 600 ssh_key -if [ -n "$DRONE_TAG" ]; then - # For a tag build use something like `session-ios-v1.2.3` - base="session-ios-$DRONE_TAG" -else - # Otherwise build a length name from the datetime and commit hash, such as: - # session-ios-20200522T212342Z-04d7dcc54 - base="session-ios-$(date --date=@$DRONE_BUILD_CREATED +%Y%m%dT%H%M%SZ)-${DRONE_COMMIT:0:9}" -fi - -mkdir -vp "$base" - -# Copy over the build products +# Define the output paths prod_path="build/Session.xcarchive" sim_path="build/Session_sim.xcarchive/Products/Applications/Session.app" -mkdir -p build - +# Validate the paths exist if [ -d $prod_path ]; then - cp -av $prod_path "$base" + suffix="-store" + target_path=$prod_path elif [ -d $sim_path ]; then - cp -av $sim_path "$base" + suffix="-sim" + target_path=$sim_path else echo -e "\n\n\n\e[31;1mExpected a file to upload, found none\e[0m" >&2 exit 1 fi +if [ -n "$DRONE_TAG" ]; then + # For a tag build use something like `session-ios-v1.2.3` + base="session-ios-$DRONE_TAG-$suffix" +else + # Otherwise build a length name from the datetime and commit hash, such as: + # session-ios-20200522T212342Z-04d7dcc54 + base="session-ios-$(date --date=@$DRONE_BUILD_CREATED +%Y%m%dT%H%M%SZ)-${DRONE_COMMIT:0:9}-$suffix" +fi + +# Copy over the build products +mkdir -vp "$base" +mkdir -p build +cp -av $target_path "$base" + # tar dat shiz up yo archive="$base.tar.xz" tar cJvf "$archive" "$base"