/
githubmirror
/
commcare-hq
Обзор
Документация
Войти
/
githubmirror
/
commcare-hq
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
scripts/rebuildstaging
72 строки
2 KB
Daniel Roberts
Exit with error when rebuild-staging fails
03 апр 2026, 04:41
03 апр 2026, 04:41
ae3a40e
Код
Авторство
О чём код?
#!/bin/bash function usage() { cat << EOF usage: $0 [-h|--help] [-v|--verbose] [--deploy|--no-push] rebuild staging from yaml configuration (downloaded from https://github.com/dimagi/staging-branches/blob/main/commcare-hq-staging.yml) -h --help print this help text -v --verbose display debugging output --deploy deploy after rebuild is complete --no-push do not push changes (cannot be used with --deploy) EOF } while [[ $# > 0 ]] do key="$1" shift case $key in --deploy) deploy=y ;; -h|--help) usage exit ;; -v|--verbose) verbose=y ;; --no-push) no_push=y echo no-push ;; *) usage exit 1 ;; esac done function rebuildstaging() { REPO_ROOT='artifacts/staging-branches' if [[ ! -d "$REPO_ROOT/.git" ]] then git clone https://github.com/dimagi/staging-branches.git "$REPO_ROOT" else git -C "$REPO_ROOT" pull origin main fi git -C "$REPO_ROOT" show -n 1 -- commcare-hq-staging.yml echo "rebuilding staging branch..." git-build-branch "$REPO_ROOT/commcare-hq-staging.yml" "$@" } args='' [[ $verbose = 'y' ]] && args="$args -v" [[ -z "$no_push" || $no_push != 'y' ]] && args="$args --push" if rebuildstaging $args ; then if [[ $deploy = 'y' && $no_push != 'y' ]]; then which commcare-cloud \ && commcare-cloud --control staging deploy --quiet \ || echo 'Could not auto-deploy for you. Run `commcare-cloud --control staging deploy` to deploy.' fi else echo "You can edit the branch build configuration here:" echo " https://github.com/dimagi/staging-branches/blob/main/commcare-hq-staging.yml" exit 1 fi