PageRenderTime 46ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/scripts/jenkins/release.sh

https://gitlab.com/x33n/angular.js
Shell | 69 lines | 41 code | 13 blank | 15 comment | 5 complexity | ac822946c806ec9a89a060eda1a3aadf MD5 | raw file
  1. #!/bin/bash
  2. # tags the current commit as a release and publishes all artifacts to
  3. # the different repositories.
  4. # Note: This will also works if the commit is in the past!
  5. echo "#################################"
  6. echo "#### cut release ############"
  7. echo "#################################"
  8. ARG_DEFS=(
  9. # require the git dryrun flag so the script can't be run without
  10. # thinking about this!
  11. "--git-push-dryrun=(true|false)"
  12. # The sha to release. Needs to be the same as HEAD.
  13. # given as parameter to double check.
  14. "--commit-sha=(.*)"
  15. # the version number of the release.
  16. # e.g. 1.2.12 or 1.2.12-rc.1
  17. "--version-number=([0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?)"
  18. # the codename of the release
  19. "--version-name=(.+)"
  20. )
  21. function init {
  22. if [[ $(git rev-parse HEAD) != $(git rev-parse $COMMIT_SHA) ]]; then
  23. echo "HEAD is not at $COMMIT_SHA"
  24. usage
  25. fi
  26. if [[ ! $VERBOSE ]]; then
  27. VERBOSE=false
  28. fi
  29. VERBOSE_ARG="--verbose=$VERBOSE"
  30. }
  31. function build {
  32. cd ../..
  33. npm install --color false
  34. grunt ci-checks package --no-color
  35. cd $SCRIPT_DIR
  36. }
  37. function phase {
  38. ACTION_ARG="--action=$1"
  39. ../angular.js/tag-release.sh $ACTION_ARG $VERBOSE_ARG\
  40. --version-number=$VERSION_NUMBER --version-name=$VERSION_NAME\
  41. --commit-sha=$COMMIT_SHA
  42. if [[ $1 == "prepare" ]]; then
  43. # The build requires the tag to be set already!
  44. build
  45. fi
  46. ../code.angularjs.org/publish.sh $ACTION_ARG $VERBOSE_ARG
  47. ../bower/publish.sh $ACTION_ARG $VERBOSE_ARG
  48. }
  49. function run {
  50. # First prepare all scripts (build, commit, tag, ...),
  51. # so we are sure everything is all right
  52. phase prepare
  53. # only then publish to github
  54. phase publish
  55. }
  56. source $(dirname $0)/../utils.inc