release.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. # Check if required CLI tools are available
  3. if ! [ -x "$(command -v grunt)" ]; then
  4. echo "Error: grunt-cli is not installed. Please type 'npm install grunt-cli -g' to install" >&2
  5. exit 1
  6. fi
  7. # Validate arguments
  8. versionBumpType=${1:-patch};
  9. if [ "$versionBumpType" != "major" ] && [ "$versionBumpType" != "minor" ] && [ "$versionBumpType" != "patch" ]; then
  10. echo "Invalid version bump argument: ${versionBumpType}. Option must be one of the following: major, minor, patch" >&2
  11. exit 1
  12. else
  13. echo "Publishing and bumping with ${versionBumpType} version bump"
  14. fi
  15. echo "Running version bump + publish script..."
  16. echo "."
  17. echo "."
  18. echo "Generating /dist and push changes + tags to Github remote 'origin'"
  19. # Checkout master branch
  20. git checkout master
  21. # Version bump
  22. grunt bump-only:"$versionBumpType"
  23. # Generate new dist
  24. grunt prod
  25. # Generate new index.html page
  26. grunt template
  27. # Force add dist contents
  28. git add dist/* --force
  29. # Commit new release tag
  30. grunt bump-commit
  31. # Push commits/tags to master branch on remote 'origin'
  32. git push origin master:master && git push --tags
  33. ## Update Github.io page
  34. sh ./scripts/update-gh-pages.sh
  35. ## Publish to NPM
  36. echo "."
  37. echo "."
  38. echo "Publishing to NPM"
  39. echo "."
  40. echo "."
  41. npm publish
  42. # Notify script is complete
  43. echo "."
  44. echo "."
  45. echo "Script complete"
  46. echo ""