ship.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #!/usr/bin/env bash
  2. #
  3. # Usage
  4. # ---------------
  5. # 1. Clone second version of Bootstrap in sibling directory named `bs-docs`.
  6. # 2. Within `bs-docs` copy, switch to `gh-pages` branch.
  7. # 3. Pull latest, re-bundle, re-npm.
  8. # 4. Run script.
  9. red=$'\e[1;31m'
  10. green=$'\e[1;32m'
  11. #blue=$'\e[1;34m'
  12. magenta=$'\e[1;35m'
  13. #cyan=$'\e[1;36m'
  14. end=$'\e[0m'
  15. # Get current version from package.json
  16. current_version=$(node -p "require('./package.json').version")
  17. if [[ $# -lt 1 ]]; then
  18. printf "\n%s⚠️ Shipping aborted. You must specify a version.\n%s" $red $end
  19. exit 1
  20. fi
  21. # Pulling latest changes, just to be sure
  22. printf "\n%s=======================================================%s" $magenta $end
  23. printf "\n%sPulling latest changes...%s" $magenta $end
  24. printf "\n%s=======================================================\n\n%s" $magenta $end
  25. git pull origin v4-dev
  26. # Update version number
  27. printf "\n%s=======================================================%s" $magenta $end
  28. printf "\n%sUpdating version number...%s" $magenta $end
  29. printf "\n%s=======================================================\n%s" $magenta $end
  30. npm run release-version "$current_version" "$1"
  31. # Build release
  32. printf "\n%s=======================================================%s" $magenta $end
  33. printf "\n%sBuilding release...%s" $magenta $end
  34. printf "\n%s=======================================================\n%s" $magenta $end
  35. npm run release
  36. # Copy the contents of the built docs site over to `bs-docs` repo
  37. printf "\n%s=======================================================%s" $magenta $end
  38. printf "\n%sCopy it over...%s" $magenta $end
  39. printf "\n%s=======================================================\n%s" $magenta $end
  40. cp -rf _gh_pages/. ../bs-docs/
  41. printf "\nDone!\n"
  42. printf "\n%s=======================================================%s" $green $end
  43. printf "\n%sSuccess, $1 is ready to review and publish.%s" $green $end
  44. printf "\n%s=======================================================\n\n%s" $green $end