#!/bin/bash steps=( "navigate to project…" "git checkout…" "backend npm install…" "building backend…" "frontend npm install…" "building frontend…" "regenerate db data…" ) commands=( "cd /opt/staging/siimee.git" "git --git-dir=/opt/staging/siimee.git --work-tree=/opt/staging/siimee.git checkout master -f" "cd /opt/staging/siimee.git/backend && npm install" "npm run build" "cd /opt/staging/siimee.git/frontend && npm install" "npm run build" "cd /opt/staging/siimee.git/backend && npm run generate && npm run reseed" ) SPAN=92 COUNT=0 hr() { printf "\n" for i in $(seq 0 $SPAN) ; do printf $1 done printf "\n" } print_step() { hr "-" let step_count=$COUNT+1 printf "* POST-RECEIVE | Step: ${step_count} of ${#steps[@]}: ${1}" hr "-" printf "\n" let COUNT++ } run() { # Header line printf "\n\n" printf "** SIIMEE **" hr "=" printf "\nStarting POST-RECEIVE…" # Body for step in ${!steps[@]}; do printf "\n" print_step "${steps[$step]}" printf "${commands[$step]}" done # Footer line printf "\n" hr "=" } run