stage.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. set -e
  3. source $(dirname $0)/common.sh
  4. repository=$(pwd)/distribution-repository
  5. pushd git-repo > /dev/null
  6. git fetch --tags --all > /dev/null
  7. popd > /dev/null
  8. git clone git-repo stage-git-repo > /dev/null
  9. pushd stage-git-repo > /dev/null
  10. snapshotVersion=$( awk -F '=' '$1 == "version" { print $2 }' gradle.properties )
  11. if [[ $RELEASE_TYPE = "M" ]]; then
  12. stageVersion=$( get_next_milestone_release $snapshotVersion)
  13. nextVersion=$snapshotVersion
  14. elif [[ $RELEASE_TYPE = "RC" ]]; then
  15. stageVersion=$( get_next_rc_release $snapshotVersion)
  16. nextVersion=$snapshotVersion
  17. elif [[ $RELEASE_TYPE = "RELEASE" ]]; then
  18. stageVersion=$( get_next_release $snapshotVersion)
  19. nextVersion=$( bump_version_number $snapshotVersion)
  20. else
  21. echo "Unknown release type $RELEASE_TYPE" >&2; exit 1;
  22. fi
  23. echo "Staging $stageVersion (next version will be $nextVersion)"
  24. sed -i "s/version=$snapshotVersion/version=$stageVersion/" gradle.properties
  25. git config user.name "Spring Builds" > /dev/null
  26. git config user.email "spring-builds@users.noreply.github.com" > /dev/null
  27. git add gradle.properties > /dev/null
  28. git commit -m"Release v$stageVersion" > /dev/null
  29. git tag -a "v$stageVersion" -m"Release v$stageVersion" > /dev/null
  30. ./gradlew --no-daemon build publish -PdistributionRepository=${repository}
  31. git reset --hard HEAD^ > /dev/null
  32. if [[ $nextVersion != $snapshotVersion ]]; then
  33. echo "Setting next development version (v$nextVersion)"
  34. sed -i "s/version=$snapshotVersion/version=$nextVersion/" gradle.properties
  35. git add gradle.properties > /dev/null
  36. git commit -m"Next development version (v$nextVersion)" > /dev/null
  37. fi
  38. echo "DONE"
  39. popd > /dev/null