fix(ios): harden beta release prep

This commit is contained in:
Nimrod Gutman
2026-03-11 11:51:47 +02:00
parent ccd0a4b751
commit 8ec00f8693
3 changed files with 68 additions and 8 deletions

View File

@@ -15,6 +15,7 @@ EOF
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
IOS_DIR="${ROOT_DIR}/apps/ios"
BUILD_DIR="${IOS_DIR}/build"
BETA_XCCONFIG="${IOS_DIR}/build/BetaRelease.xcconfig"
TEAM_HELPER="${ROOT_DIR}/scripts/ios-team-id.sh"
VERSION_HELPER="${ROOT_DIR}/scripts/ios-write-version-xcconfig.sh"
@@ -23,6 +24,29 @@ BUILD_NUMBER=""
TEAM_ID="${IOS_DEVELOPMENT_TEAM:-}"
PACKAGE_VERSION="$(cd "${ROOT_DIR}" && node -p "require('./package.json').version" 2>/dev/null || true)"
prepare_build_dir() {
if [[ -L "${BUILD_DIR}" ]]; then
echo "Refusing to use symlinked build directory: ${BUILD_DIR}" >&2
exit 1
fi
mkdir -p "${BUILD_DIR}"
}
write_generated_file() {
local output_path="$1"
local tmp_file=""
if [[ -e "${output_path}" && -L "${output_path}" ]]; then
echo "Refusing to overwrite symlinked file: ${output_path}" >&2
exit 1
fi
tmp_file="$(mktemp "${output_path}.XXXXXX")"
cat >"${tmp_file}"
mv -f "${tmp_file}" "${output_path}"
}
while [[ $# -gt 0 ]]; do
case "$1" in
--)
@@ -58,13 +82,18 @@ if [[ -z "${TEAM_ID}" ]]; then
TEAM_ID="$(IOS_ALLOW_KEYCHAIN_TEAM_FALLBACK=1 bash "${TEAM_HELPER}")"
fi
mkdir -p "${IOS_DIR}/build"
if [[ -z "${TEAM_ID}" ]]; then
echo "Could not resolve Apple Team ID. Set IOS_DEVELOPMENT_TEAM or sign into Xcode." >&2
exit 1
fi
prepare_build_dir
(
bash "${VERSION_HELPER}" --build-number "${BUILD_NUMBER}"
)
cat >"${BETA_XCCONFIG}" <<EOF
write_generated_file "${BETA_XCCONFIG}" <<EOF
// Auto-generated by scripts/ios-beta-prepare.sh.
// Local beta-release override; do not commit.
OPENCLAW_CODE_SIGN_STYLE = Automatic

View File

@@ -15,10 +15,34 @@ EOF
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
IOS_DIR="${ROOT_DIR}/apps/ios"
BUILD_DIR="${IOS_DIR}/build"
VERSION_XCCONFIG="${IOS_DIR}/build/Version.xcconfig"
PACKAGE_VERSION="$(cd "${ROOT_DIR}" && node -p "require('./package.json').version" 2>/dev/null || true)"
BUILD_NUMBER=""
prepare_build_dir() {
if [[ -L "${BUILD_DIR}" ]]; then
echo "Refusing to use symlinked build directory: ${BUILD_DIR}" >&2
exit 1
fi
mkdir -p "${BUILD_DIR}"
}
write_generated_file() {
local output_path="$1"
local tmp_file=""
if [[ -e "${output_path}" && -L "${output_path}" ]]; then
echo "Refusing to overwrite symlinked file: ${output_path}" >&2
exit 1
fi
tmp_file="$(mktemp "${output_path}.XXXXXX")"
cat >"${tmp_file}"
mv -f "${tmp_file}" "${output_path}"
}
while [[ $# -gt 0 ]]; do
case "$1" in
--)
@@ -62,9 +86,9 @@ if [[ ! "${BUILD_NUMBER}" =~ ^[0-9]+$ ]]; then
exit 1
fi
mkdir -p "${IOS_DIR}/build"
prepare_build_dir
cat >"${VERSION_XCCONFIG}" <<EOF
write_generated_file "${VERSION_XCCONFIG}" <<EOF
// Auto-generated by scripts/ios-write-version-xcconfig.sh.
// Local version override; do not commit.
OPENCLAW_GATEWAY_VERSION = ${PACKAGE_VERSION}