build: package production configs and use system protoc

This commit is contained in:
2026-08-09 18:40:36 +08:00
parent 4fe24d9770
commit 9f6f318bbb
113 changed files with 221 additions and 141 deletions

View File

@@ -5,8 +5,9 @@ set -Eeuo pipefail
readonly SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
readonly WORKSPACE_ROOT="$(cd -- "${SCRIPT_DIR}/.." && pwd)"
readonly MODULE_ROOT="${WORKSPACE_ROOT}/module"
readonly BUILD_ROOT="${WORKSPACE_ROOT}/builds"
readonly BUILD_ROOT="${WORKSPACE_ROOT}/.builds"
readonly ENTRY_ROOT="${BUILD_ROOT}/.entries"
readonly CONFIG_ROOT="${BUILD_ROOT}/etc"
if ! command -v go >/dev/null 2>&1; then
echo "error: Go is not installed or is not available in PATH" >&2
@@ -87,4 +88,18 @@ for module_dir in "${modules[@]}"; do
)
done
# Copy production configuration only after every service has compiled successfully.
mkdir -p "${CONFIG_ROOT}"
config_count=0
for module_dir in "${modules[@]}"; do
module_name="$(basename -- "${module_dir}")"
config_name="${module_name}_prod.yaml"
config_file="${module_dir}/etc/${config_name}"
[[ -f "${config_file}" ]] || continue
cp -- "${config_file}" "${CONFIG_ROOT}/${config_name}"
((config_count += 1))
done
echo "Copied ${config_count} production configs to ${CONFIG_ROOT}"
echo "Build completed successfully: ${BUILD_ROOT}"