You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

release-sdk.sh 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/bash
  2. set -e -u
  3. THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
  4. DEFAULT_MVN_REPO="${THIS_DIR}/../../../jitsi-maven-repository/releases"
  5. THE_MVN_REPO=${MVN_REPO:-${1:-$DEFAULT_MVN_REPO}}
  6. MVN_HTTP=0
  7. DEFAULT_SDK_VERSION=$(grep sdkVersion ${THIS_DIR}/../gradle.properties | cut -d"=" -f2)
  8. SDK_VERSION=${OVERRIDE_SDK_VERSION:-${DEFAULT_SDK_VERSION}}
  9. RN_VERSION=$(jq -r '.version' ${THIS_DIR}/../../node_modules/react-native/package.json)
  10. HERMES_VERSION=$(jq -r '.dependencies."hermes-engine"' ${THIS_DIR}/../../node_modules/react-native/package.json | cut -c 2-)
  11. DO_GIT_TAG=${GIT_TAG:-0}
  12. if [[ $THE_MVN_REPO == http* ]]; then
  13. MVN_HTTP=1
  14. else
  15. MVN_REPO_PATH=$(realpath $THE_MVN_REPO)
  16. THE_MVN_REPO="file:${MVN_REPO_PATH}"
  17. fi
  18. export MVN_REPO=$THE_MVN_REPO
  19. echo "Releasing Jitsi Meet SDK ${SDK_VERSION}"
  20. echo "Using ${MVN_REPO} as the Maven repo"
  21. if [[ $MVN_HTTP == 1 ]]; then
  22. # Push React Native
  23. echo "Pushing React Native ${RN_VERSION} to the Maven repo"
  24. pushd ${THIS_DIR}/../../node_modules/react-native/android/com/facebook/react/react-native/${RN_VERSION}
  25. mvn \
  26. deploy:deploy-file \
  27. -Durl=${MVN_REPO} \
  28. -DrepositoryId=${MVN_REPO_ID} \
  29. -Dfile=react-native-${RN_VERSION}.aar \
  30. -Dpackaging=aar \
  31. -DgeneratePom=false \
  32. -DpomFile=react-native-${RN_VERSION}.pom || true
  33. popd
  34. # Push Hermes
  35. echo "Pushing Hermes ${HERMES_VERSION} to the Maven repo"
  36. pushd ${THIS_DIR}/../../node_modules/hermes-engine/android/
  37. mvn \
  38. deploy:deploy-file \
  39. -Durl=${MVN_REPO} \
  40. -DrepositoryId=${MVN_REPO_ID} \
  41. -Dfile=hermes-release.aar \
  42. -Dpackaging=aar \
  43. -DgroupId=com.facebook \
  44. -DartifactId=hermes \
  45. -Dversion=${HERMES_VERSION} \
  46. -DgeneratePom=true || true
  47. popd
  48. else
  49. # Push React Native, if necessary
  50. if [[ ! -d ${MVN_REPO}/com/facebook/react/react-native/${RN_VERSION} ]]; then
  51. echo "Pushing React Native ${RN_VERSION} to the Maven repo"
  52. pushd ${THIS_DIR}/../../node_modules/react-native/android/com/facebook/react/react-native/${RN_VERSION}
  53. mvn \
  54. deploy:deploy-file \
  55. -Durl=${MVN_REPO} \
  56. -Dfile=react-native-${RN_VERSION}.aar \
  57. -Dpackaging=aar \
  58. -DgeneratePom=false \
  59. -DpomFile=react-native-${RN_VERSION}.pom
  60. popd
  61. fi
  62. # Push Hermes, if necessary
  63. if [[ ! -d ${MVN_REPO}/com/facebook/hermes/${HERMES_VERSION} ]]; then
  64. echo "Pushing Hermes ${HERMES_VERSION} to the Maven repo"
  65. pushd ${THIS_DIR}/../../node_modules/hermes-engine/android/
  66. mvn \
  67. deploy:deploy-file \
  68. -Durl=${MVN_REPO} \
  69. -Dfile=hermes-release.aar \
  70. -Dpackaging=aar \
  71. -DgroupId=com.facebook \
  72. -DartifactId=hermes \
  73. -Dversion=${HERMES_VERSION} \
  74. -DgeneratePom=true
  75. popd
  76. fi
  77. # Check if an SDK with that same version has already been released
  78. if [[ -d ${MVN_REPO}/org/jitsi/react/jitsi-meet-sdk/${SDK_VERSION} ]]; then
  79. echo "There is already a release with that version in the Maven repo!"
  80. exit 1
  81. fi
  82. fi
  83. # Now build and publish the Jitsi Meet SDK and its dependencies
  84. echo "Building and publishing the Jitsi Meet SDK"
  85. pushd ${THIS_DIR}/../
  86. ./gradlew clean assembleRelease publish
  87. popd
  88. if [[ $DO_GIT_TAG == 1 ]]; then
  89. # The artifacts are now on the Maven repo, commit them
  90. pushd ${MVN_REPO_PATH}
  91. git add -A .
  92. git commit -m "Jitsi Meet SDK + dependencies: ${SDK_VERSION}"
  93. popd
  94. # Tag the release
  95. git tag android-sdk-${SDK_VERSION}
  96. fi
  97. # Done!
  98. echo "Finished! Don't forget to push the tag and the Maven repo artifacts."