2019-04-03 10:01:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e -u
|
|
|
|
|
|
|
|
|
|
|
|
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
|
|
|
|
DEFAULT_MVN_REPO="${THIS_DIR}/../../../jitsi-maven-repository/releases"
|
2019-04-11 12:01:52 +00:00
|
|
|
THE_MVN_REPO=${MVN_REPO:-${1:-$DEFAULT_MVN_REPO}}
|
|
|
|
MVN_HTTP=0
|
2019-04-12 12:56:41 +00:00
|
|
|
DEFAULT_SDK_VERSION=$(grep sdkVersion ${THIS_DIR}/../gradle.properties | cut -d"=" -f2)
|
|
|
|
SDK_VERSION=${OVERRIDE_SDK_VERSION:-${DEFAULT_SDK_VERSION}}
|
2020-02-19 12:17:47 +00:00
|
|
|
RN_VERSION=$(jq -r '.version' ${THIS_DIR}/../../node_modules/react-native/package.json)
|
2020-02-04 12:34:38 +00:00
|
|
|
HERMES_VERSION=$(jq -r '.dependencies."hermes-engine"' ${THIS_DIR}/../../node_modules/react-native/package.json | cut -c 2-)
|
2019-05-23 08:56:41 +00:00
|
|
|
DO_GIT_TAG=${GIT_TAG:-0}
|
2019-04-03 10:01:34 +00:00
|
|
|
|
2019-04-11 12:01:52 +00:00
|
|
|
if [[ $THE_MVN_REPO == http* ]]; then
|
|
|
|
MVN_HTTP=1
|
|
|
|
else
|
|
|
|
MVN_REPO_PATH=$(realpath $THE_MVN_REPO)
|
|
|
|
THE_MVN_REPO="file:${MVN_REPO_PATH}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
export MVN_REPO=$THE_MVN_REPO
|
2019-04-03 10:01:34 +00:00
|
|
|
|
|
|
|
echo "Releasing Jitsi Meet SDK ${SDK_VERSION}"
|
|
|
|
echo "Using ${MVN_REPO} as the Maven repo"
|
|
|
|
|
2019-04-11 12:01:52 +00:00
|
|
|
if [[ $MVN_HTTP == 1 ]]; then
|
|
|
|
# Push React Native
|
2019-04-03 10:01:34 +00:00
|
|
|
echo "Pushing React Native ${RN_VERSION} to the Maven repo"
|
|
|
|
pushd ${THIS_DIR}/../../node_modules/react-native/android/com/facebook/react/react-native/${RN_VERSION}
|
|
|
|
mvn \
|
|
|
|
deploy:deploy-file \
|
2019-04-11 12:01:52 +00:00
|
|
|
-Durl=${MVN_REPO} \
|
|
|
|
-DrepositoryId=${MVN_REPO_ID} \
|
2019-04-03 10:01:34 +00:00
|
|
|
-Dfile=react-native-${RN_VERSION}.aar \
|
|
|
|
-Dpackaging=aar \
|
|
|
|
-DgeneratePom=false \
|
2019-04-11 12:01:52 +00:00
|
|
|
-DpomFile=react-native-${RN_VERSION}.pom || true
|
2019-04-03 10:01:34 +00:00
|
|
|
popd
|
2020-02-04 12:34:38 +00:00
|
|
|
# Push Hermes
|
|
|
|
echo "Pushing Hermes ${HERMES_VERSION} to the Maven repo"
|
|
|
|
pushd ${THIS_DIR}/../../node_modules/hermes-engine/android/
|
2019-09-05 14:02:04 +00:00
|
|
|
mvn \
|
|
|
|
deploy:deploy-file \
|
|
|
|
-Durl=${MVN_REPO} \
|
|
|
|
-DrepositoryId=${MVN_REPO_ID} \
|
2020-02-04 12:34:38 +00:00
|
|
|
-Dfile=hermes-release.aar \
|
2019-09-05 14:02:04 +00:00
|
|
|
-Dpackaging=aar \
|
2020-02-04 12:34:38 +00:00
|
|
|
-DgroupId=com.facebook \
|
|
|
|
-DartifactId=hermes \
|
|
|
|
-Dversion=${HERMES_VERSION} \
|
|
|
|
-DgeneratePom=true || true
|
2019-09-05 14:02:04 +00:00
|
|
|
popd
|
2019-04-11 12:01:52 +00:00
|
|
|
else
|
2019-09-05 14:02:04 +00:00
|
|
|
# Push React Native, if necessary
|
2019-04-11 12:01:52 +00:00
|
|
|
if [[ ! -d ${MVN_REPO}/com/facebook/react/react-native/${RN_VERSION} ]]; then
|
|
|
|
echo "Pushing React Native ${RN_VERSION} to the Maven repo"
|
|
|
|
pushd ${THIS_DIR}/../../node_modules/react-native/android/com/facebook/react/react-native/${RN_VERSION}
|
|
|
|
mvn \
|
|
|
|
deploy:deploy-file \
|
|
|
|
-Durl=${MVN_REPO} \
|
|
|
|
-Dfile=react-native-${RN_VERSION}.aar \
|
|
|
|
-Dpackaging=aar \
|
|
|
|
-DgeneratePom=false \
|
|
|
|
-DpomFile=react-native-${RN_VERSION}.pom
|
|
|
|
popd
|
|
|
|
fi
|
2019-09-05 14:02:04 +00:00
|
|
|
|
2020-02-04 12:34:38 +00:00
|
|
|
# Push Hermes, if necessary
|
|
|
|
if [[ ! -d ${MVN_REPO}/com/facebook/hermes/${HERMES_VERSION} ]]; then
|
|
|
|
echo "Pushing Hermes ${HERMES_VERSION} to the Maven repo"
|
|
|
|
pushd ${THIS_DIR}/../../node_modules/hermes-engine/android/
|
2019-09-05 14:02:04 +00:00
|
|
|
mvn \
|
|
|
|
deploy:deploy-file \
|
|
|
|
-Durl=${MVN_REPO} \
|
2020-02-04 12:34:38 +00:00
|
|
|
-Dfile=hermes-release.aar \
|
2019-09-05 14:02:04 +00:00
|
|
|
-Dpackaging=aar \
|
2020-02-04 12:34:38 +00:00
|
|
|
-DgroupId=com.facebook \
|
|
|
|
-DartifactId=hermes \
|
|
|
|
-Dversion=${HERMES_VERSION} \
|
|
|
|
-DgeneratePom=true
|
2019-09-05 14:02:04 +00:00
|
|
|
popd
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check if an SDK with that same version has already been released
|
|
|
|
if [[ -d ${MVN_REPO}/org/jitsi/react/jitsi-meet-sdk/${SDK_VERSION} ]]; then
|
|
|
|
echo "There is already a release with that version in the Maven repo!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2019-04-03 10:01:34 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Now build and publish the Jitsi Meet SDK and its dependencies
|
|
|
|
echo "Building and publishing the Jitsi Meet SDK"
|
|
|
|
pushd ${THIS_DIR}/../
|
|
|
|
./gradlew clean assembleRelease publish
|
|
|
|
popd
|
|
|
|
|
2019-05-23 08:56:41 +00:00
|
|
|
if [[ $DO_GIT_TAG == 1 ]]; then
|
2019-04-11 12:01:52 +00:00
|
|
|
# The artifacts are now on the Maven repo, commit them
|
|
|
|
pushd ${MVN_REPO_PATH}
|
2019-05-23 08:56:41 +00:00
|
|
|
git add -A .
|
|
|
|
git commit -m "Jitsi Meet SDK + dependencies: ${SDK_VERSION}"
|
2019-04-11 12:01:52 +00:00
|
|
|
popd
|
2019-04-03 10:01:34 +00:00
|
|
|
|
2019-04-11 12:01:52 +00:00
|
|
|
# Tag the release
|
2019-05-14 12:46:59 +00:00
|
|
|
git tag android-sdk-${SDK_VERSION}
|
2019-04-11 12:01:52 +00:00
|
|
|
fi
|
2019-04-03 10:01:34 +00:00
|
|
|
|
|
|
|
# Done!
|
|
|
|
echo "Finished! Don't forget to push the tag and the Maven repo artifacts."
|