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 2.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. SDK_VERSION=$(grep sdkVersion ${THIS_DIR}/../gradle.properties | cut -d"=" -f2)
  8. RN_VERSION=$(jq -r '.dependencies."react-native"' ${THIS_DIR}/../../package.json)
  9. if [[ $THE_MVN_REPO == http* ]]; then
  10. MVN_HTTP=1
  11. else
  12. MVN_REPO_PATH=$(realpath $THE_MVN_REPO)
  13. THE_MVN_REPO="file:${MVN_REPO_PATH}"
  14. fi
  15. export MVN_REPO=$THE_MVN_REPO
  16. echo "Releasing Jitsi Meet SDK ${SDK_VERSION}"
  17. echo "Using ${MVN_REPO} as the Maven repo"
  18. if [[ $MVN_HTTP == 1 ]]; then
  19. # Push React Native
  20. echo "Pushing React Native ${RN_VERSION} to the Maven repo"
  21. pushd ${THIS_DIR}/../../node_modules/react-native/android/com/facebook/react/react-native/${RN_VERSION}
  22. mvn \
  23. deploy:deploy-file \
  24. -Durl=${MVN_REPO} \
  25. -DrepositoryId=${MVN_REPO_ID} \
  26. -Dfile=react-native-${RN_VERSION}.aar \
  27. -Dpackaging=aar \
  28. -DgeneratePom=false \
  29. -DpomFile=react-native-${RN_VERSION}.pom || true
  30. popd
  31. else
  32. # Check if an SDK with that same version has already been released
  33. if [[ -d ${MVN_REPO}/org/jitsi/react/jitsi-meet-sdk/${SDK_VERSION} ]]; then
  34. echo "There is already a release with that version in the Maven repo!"
  35. exit 1
  36. fi
  37. # First push React Native, if necessary
  38. if [[ ! -d ${MVN_REPO}/com/facebook/react/react-native/${RN_VERSION} ]]; then
  39. echo "Pushing React Native ${RN_VERSION} to the Maven repo"
  40. pushd ${THIS_DIR}/../../node_modules/react-native/android/com/facebook/react/react-native/${RN_VERSION}
  41. mvn \
  42. deploy:deploy-file \
  43. -Durl=${MVN_REPO} \
  44. -Dfile=react-native-${RN_VERSION}.aar \
  45. -Dpackaging=aar \
  46. -DgeneratePom=false \
  47. -DpomFile=react-native-${RN_VERSION}.pom
  48. popd
  49. fi
  50. fi
  51. # Now build and publish the Jitsi Meet SDK and its dependencies
  52. echo "Building and publishing the Jitsi Meet SDK"
  53. pushd ${THIS_DIR}/../
  54. ./gradlew clean assembleRelease publish
  55. popd
  56. if [[ $MVN_HTTP == 0 ]]; then
  57. # The artifacts are now on the Maven repo, commit them
  58. pushd ${MVN_REPO_PATH}
  59. if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" == "true" ]]; then
  60. git add -A .
  61. git commit -m "Jitsi Meet SDK + dependencies"
  62. fi
  63. popd
  64. # Tag the release
  65. git tag -a android-sdk-${SDK_VERSION}
  66. fi
  67. # Done!
  68. echo "Finished! Don't forget to push the tag and the Maven repo artifacts."