chore(deploy): possibilidade de fazer multiplos commits antes do push
This commit is contained in:
31
deploy.sh
31
deploy.sh
@@ -96,14 +96,7 @@ success "Branch: ${BOLD}$BRANCH${RESET}"
|
||||
# ──────────────────────────────────────────
|
||||
# GATE 2 — Working tree limpa
|
||||
# ──────────────────────────────────────────
|
||||
step "[ 2/6 ] Verificando working tree..."
|
||||
|
||||
UNTRACKED=$(git ls-files --others --exclude-standard)
|
||||
MODIFIED=$(git diff --name-only)
|
||||
STAGED=$(git diff --cached --name-only)
|
||||
|
||||
if [[ -n "$UNTRACKED" || -n "$MODIFIED" || -n "$STAGED" ]]; then
|
||||
|
||||
function worktree() {
|
||||
# Em modo release, working tree tem de estar absolutamente limpa
|
||||
if [[ -n "$RELEASE_TYPE" ]]; then
|
||||
warn "Arquivos não commitados:"
|
||||
@@ -213,6 +206,28 @@ if [[ -n "$UNTRACKED" || -n "$MODIFIED" || -n "$STAGED" ]]; then
|
||||
for f in "${SELECTED_FILES[@]}"; do run git add -- "$f"; done
|
||||
run git commit -m "$COMMIT_MSG"
|
||||
success "Commit criado."
|
||||
}
|
||||
|
||||
step "[ 2/6 ] Verificando working tree..."
|
||||
|
||||
function thereschanges(){
|
||||
UNTRACKED=$(git ls-files --others --exclude-standard)
|
||||
MODIFIED=$(git diff --name-only)
|
||||
STAGED=$(git diff --cached --name-only)
|
||||
if [[ -n "$UNTRACKED" || -n "$MODIFIED" || -n "$STAGED" ]]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
if thereschanges; then
|
||||
worktree
|
||||
if thereschanges; then
|
||||
echo -n "Deseja criar outro commit? [s/N]: "
|
||||
read -r OTHERCOMMIT
|
||||
[[ "$OTHERCOMMIT" =~ ^[sS]$ ]] && worktree
|
||||
fi
|
||||
else
|
||||
success "Working tree limpa."
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user