Files
IronFox/scripts/ci-compress.sh
2026-04-04 22:42:33 +05:30

49 lines
1.3 KiB
Bash

#!/bin/bash
## This script is expected to be executed in a CI environment, or possibly in our Docker image instance
## DO NOT execute this manually!
set -eu
set -o pipefail
set -o xtrace
source "$(dirname "$0")/utilities.sh"
source "$(dirname "$0")"/env.sh
artifact_name="${IRONFOX_JOB_ARTIFACT_NAME}.tar.xz"
artifact_path="${IRONFOX_ARTIFACTS}/${artifact_name}"
function ironfox_package_artifacts() {
# For debugging purposes
echo "Listing available artifacts"
find "$IRONFOX_ARTIFACTS"
includes=$(echo "$IRONFOX_ARTIFACT_INCLUDES" | tr ";" "\n")
paths=()
for include in $includes; do
path="${IRONFOX_ARTIFACTS}/$include"
if [[ -e "$path" ]]; then
echo "Including $path"
paths+=("$include")
else
echo_red_text "Warning: $path does not exist!"
fi
done
if [[ ${#paths[@]} -eq 0 ]]; then
echo_red_text "No valid artifact paths found. Creating empty artifact."
touch "$artifact_path"
return
fi
mkdir -p "${IRONFOX_ARTIFACTS}"
tar cvJf "$artifact_path" -C "${IRONFOX_ARTIFACTS}" "${paths[@]}"
}
if [[ -z "${IRONFOX_ARTIFACT_INCLUDES}" ]]; then
echo_red_text "IRONFOX_ARTIFACT_INCLUDES has not been specified. Creating empty artifact."
touch "$artifact_path"
else
ironfox_package_artifacts
fi