Files
feedc0de ea50a260fa
Validate, publish, and deploy Brave Sync / validate (push) Failing after 15s
Validate, publish, and deploy Brave Sync / image (push) Skipped
Validate, publish, and deploy Brave Sync / chart (push) Skipped
Validate, publish, and deploy Brave Sync / deploy (push) Skipped
Initial commit with the existing deployment files
2026-10-09 11:39:38 +02:00

26 lines
895 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
project_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)
output_dir=${1:?usage: package.sh OUTPUT_DIR IMAGE_TAG [VERSION_SUFFIX]}
image_tag=${2:?IMAGE_TAG is required}
suffix=${3:-}
base_version=$(<"${project_dir}/chart-version.txt")
[[ "${base_version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || {
echo "chart-version.txt must contain a three-part numeric version" >&2
exit 1
}
[[ "${image_tag}" =~ ^[A-Za-z0-9][A-Za-z0-9_.-]*$ ]] || {
echo "Invalid image tag" >&2
exit 1
}
version=${base_version}
if [[ -n "${suffix}" ]]; then
[[ "${suffix}" =~ ^[A-Za-z0-9][A-Za-z0-9.-]*$ ]] || exit 1
version="${base_version}-${suffix}"
fi
mkdir -p -- "${output_dir}"
helm package "${project_dir}" --destination "${output_dir}" \
--version "${version}" --app-version "${image_tag}" >/dev/null
printf '%s/brave-sync-%s.tgz\n' "${output_dir%/}" "${version}"