#!/usr/bin/env bash # Bash 5.3+ can deadlock writing heredoc pipes on macOS before the reader starts. if [[ ${OSTYPE:-} == darwin* && $BASH != /bin/bash ]] && ((BASH_VERSINFO[0] > 5 || (BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] >= 3))); then exec /bin/bash "$0" "$@" fi set -euo pipefail usage() { cat <<'EOF' Usage: scripts/android-release-upload.sh [--destination play-store|internal] Uploads Android Play metadata, builds signed release artifacts, and uploads the Play AAB to Google Play internal testing by default. This does not promote the build to production. Use --destination internal to upload builds and notes without changing the listing or capturing screenshots. EOF } ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" source "${ROOT_DIR}/scripts/lib/android-fastlane.sh" destination="play-store" while [[ $# -gt 0 ]]; do case "$1" in --) shift ;; --destination) case "${2:-}" in play-store|internal) destination="$2" ;; *) echo "Choose --destination play-store or internal." >&2; exit 1 ;; esac shift 2 ;; -h|--help) usage exit 0 ;; *) echo "Unknown argument: $1" >&2 usage exit 1 ;; esac done ( cd "${ROOT_DIR}/apps/android" run_android_fastlane android release_upload "destination:${destination}" )