Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. function releaseApp {
  4. echo 'Go to develop and update...'
  5. cd $BASE_PATH$1
  6. git pull --rebase
  7.  
  8. echo 'Go to master and update...'
  9. git checkout master
  10. git pull --rebase
  11.  
  12. echo 'Up master version...'
  13. mvn org.codehaus.mojo:versions-maven-plugin:2.1:update-parent org.codehaus.mojo:versions-maven-plugin:2.1:set org.codehaus.mojo:versions-maven-plugin:2.1:commit -DnewVersion=$MASTER_VERSION
  14. git commit -am 'Release '$MASTER_VERSION' - podbicie wersji'
  15.  
  16. echo 'Finish release '$MASTER_VERSION' ...'
  17. git checkout 'release'$BRANCH_SEPARATOR$MASTER_VERSION
  18. git flow release finish -F -p -m 'new_tag' $MASTER_VERSION
  19.  
  20. echo 'Autosolve conflicts on master...'
  21. grep -lr "<<<<<<<" . | xargs git checkout --ours
  22. git commit -am 'Merge release z master- rozwiazanie konfliktow'
  23. git flow release finish -F -p -m 'new_tag' $MASTER_VERSION
  24.  
  25. echo 'Autosolve conflicts on develop...'
  26. git checkout develop
  27. grep -lr "<<<<<<<" . | xargs git checkout --ours
  28. git commit -m 'Merge release z develop- rozwiazanie konfliktow'
  29. git add -A
  30. git flow release finish -F -p -m 'new_tag' $MASTER_VERSION
  31.  
  32. echo 'Start and publish new release...'
  33. git flow release start $NEW_RELEASE_VERSION
  34. git flow release publish $NEW_RELEASE_VERSION
  35.  
  36. echo 'Up develop version...'
  37. git checkout develop
  38. mvn org.codehaus.mojo:versions-maven-plugin:2.1:update-parent org.codehaus.mojo:versions-maven-plugin:2.1:set org.codehaus.mojo:versions-maven-plugin:2.1:commit -DnewVersion=$NEW_DEV_VERSION'-SNAPSHOT'
  39. git commit -am "Podbicie wersji develop"
  40. git push origin develop
  41. }
  42.  
  43. function validateParams {
  44. if [ "$1" = '' ] ; then
  45. echo 'First parameter should be MASTER_VERSION ex. 51...'
  46. exit 0
  47. fi
  48.  
  49. if [ "$2" != "-" ] && [ "$2" != "/" ] ; then
  50. echo 'Second parameter should be separator "-" or "/"'
  51. exit 0
  52. fi
  53. }
  54.  
  55. #to not display merge message editor
  56. export GIT_MERGE_AUTOEDIT=no
  57.  
  58. BASE_PATH='/Users/piotrkorlaga/Development/Source/'
  59. DIRS=('umk-seup-integration')
  60.  
  61.  
  62. BRANCH_SEPARATOR=$2
  63. VERSION=$1
  64.  
  65. validateParams $VERSION $BRANCH_SEPARATOR
  66.  
  67. MASTER_VERSION=0.$1.0
  68. NEW_RELEASE_VERSION=0.$(($1+1)).0
  69. NEW_DEV_VERSION=0.$(($1+2)).0
  70.  
  71. echo 'Master version: '$MASTER_VERSION
  72. echo 'New release version: '$NEW_RELEASE_VERSION
  73. echo 'New dev version: '$NEW_DEV_VERSION
  74. echo 'Separator: '$BRANCH_SEPARATOR
  75.  
  76. ELEMENTS=${#DIRS[@]}
  77. for (( i=0;i<$ELEMENTS;i++)); do
  78. releaseApp ${DIRS[${i}]}
  79. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement