You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

post-receive 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. steps=(
  3. "navigate to project…"
  4. "git checkout…"
  5. "backend npm install…"
  6. "building backend…"
  7. "frontend npm install…"
  8. "building frontend…"
  9. "regenerate db data…"
  10. )
  11. commands=(
  12. "cd /opt/staging/siimee.git"
  13. "git --git-dir=/opt/staging/siimee.git --work-tree=/opt/staging/siimee.git checkout master -f"
  14. "cd /opt/staging/siimee.git/backend && npm install"
  15. "npm run build"
  16. "cd /opt/staging/siimee.git/frontend && npm install"
  17. "npm run build"
  18. "cd /opt/staging/siimee.git/backend && npm run generate && npm run reseed"
  19. )
  20. SPAN=92
  21. COUNT=0
  22. hr() {
  23. printf "\n"
  24. for i in $(seq 0 $SPAN) ; do
  25. printf $1
  26. done
  27. printf "\n"
  28. }
  29. print_step() {
  30. hr "-"
  31. let step_count=$COUNT+1
  32. printf "* POST-RECEIVE | Step: ${step_count} of ${#steps[@]}: ${1}"
  33. hr "-"
  34. printf "\n"
  35. let COUNT++
  36. }
  37. run() {
  38. # Header line
  39. printf "\n\n"
  40. printf "** SIIMEE **"
  41. hr "="
  42. printf "\nStarting POST-RECEIVE…"
  43. # Body
  44. for step in ${!steps[@]}; do
  45. printf "\n"
  46. print_step "${steps[$step]}"
  47. eval "${commands[$step]}"
  48. done
  49. # Footer line
  50. printf "\n"
  51. hr "="
  52. }
  53. run