android: improve SDK release script
- don't hardcode defaults in gradle files - allow for uploading also to HTTP URLs - support HTTP authentication when publishing
This commit is contained in:
parent
088b5d95c2
commit
b78989f5f2
|
@ -55,7 +55,15 @@ allprojects {
|
||||||
publishing {
|
publishing {
|
||||||
publications {}
|
publications {}
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "file:${rootProject.ext.mavenRepo}" }
|
maven {
|
||||||
|
url rootProject.ext.mavenRepo
|
||||||
|
if (!rootProject.ext.mavenRepo.startsWith("file")) {
|
||||||
|
credentials {
|
||||||
|
username rootProject.ext.mavenUser
|
||||||
|
password rootProject.ext.mavenPassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,7 +160,9 @@ ext {
|
||||||
moduleGroupId = 'com.facebook.react'
|
moduleGroupId = 'com.facebook.react'
|
||||||
|
|
||||||
// Maven repo where artifacts will be published
|
// Maven repo where artifacts will be published
|
||||||
mavenRepo = System.env.MVN_REPO ?: "${rootProject.projectDir}/../../jitsi-maven-repository/releases"
|
mavenRepo = System.env.MVN_REPO ?: ""
|
||||||
|
mavenUser = System.env.MVN_USER ?: ""
|
||||||
|
mavenPassword = System.env.MVN_PASSWORD ?: ""
|
||||||
|
|
||||||
// Glide
|
// Glide
|
||||||
excludeAppGlideModule = true
|
excludeAppGlideModule = true
|
||||||
|
|
|
@ -5,32 +5,56 @@ set -e -u
|
||||||
|
|
||||||
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
|
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
|
||||||
DEFAULT_MVN_REPO="${THIS_DIR}/../../../jitsi-maven-repository/releases"
|
DEFAULT_MVN_REPO="${THIS_DIR}/../../../jitsi-maven-repository/releases"
|
||||||
export MVN_REPO=$(realpath ${1:-$DEFAULT_MVN_REPO})
|
THE_MVN_REPO=${MVN_REPO:-${1:-$DEFAULT_MVN_REPO}}
|
||||||
|
MVN_HTTP=0
|
||||||
SDK_VERSION=$(grep sdkVersion ${THIS_DIR}/../gradle.properties | cut -d"=" -f2)
|
SDK_VERSION=$(grep sdkVersion ${THIS_DIR}/../gradle.properties | cut -d"=" -f2)
|
||||||
RN_VERSION=$(jq -r '.dependencies."react-native"' ${THIS_DIR}/../../package.json)
|
RN_VERSION=$(jq -r '.dependencies."react-native"' ${THIS_DIR}/../../package.json)
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
echo "Releasing Jitsi Meet SDK ${SDK_VERSION}"
|
echo "Releasing Jitsi Meet SDK ${SDK_VERSION}"
|
||||||
echo "Using ${MVN_REPO} as the Maven repo"
|
echo "Using ${MVN_REPO} as the Maven repo"
|
||||||
|
|
||||||
# Check if an SDK with that same version has already been released
|
if [[ $MVN_HTTP == 1 ]]; then
|
||||||
if [[ -d ${MVN_REPO}/org/jitsi/react/jitsi-meet-sdk/${SDK_VERSION} ]]; then
|
# Push React Native
|
||||||
echo "There is already a release with that version in the Maven repo!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# First push React Native, if necessary
|
|
||||||
if [[ ! -d ${MVN_REPO}/com/facebook/react/react-native/${RN_VERSION} ]]; then
|
|
||||||
echo "Pushing React Native ${RN_VERSION} to the Maven repo"
|
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}
|
pushd ${THIS_DIR}/../../node_modules/react-native/android/com/facebook/react/react-native/${RN_VERSION}
|
||||||
mvn \
|
mvn \
|
||||||
deploy:deploy-file \
|
deploy:deploy-file \
|
||||||
-Durl=file://${MVN_REPO} \
|
-Durl=${MVN_REPO} \
|
||||||
|
-DrepositoryId=${MVN_REPO_ID} \
|
||||||
-Dfile=react-native-${RN_VERSION}.aar \
|
-Dfile=react-native-${RN_VERSION}.aar \
|
||||||
-Dpackaging=aar \
|
-Dpackaging=aar \
|
||||||
-DgeneratePom=false \
|
-DgeneratePom=false \
|
||||||
-DpomFile=react-native-${RN_VERSION}.pom
|
-DpomFile=react-native-${RN_VERSION}.pom || true
|
||||||
popd
|
popd
|
||||||
|
else
|
||||||
|
# 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
|
||||||
|
|
||||||
|
# First push React Native, if necessary
|
||||||
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Now build and publish the Jitsi Meet SDK and its dependencies
|
# Now build and publish the Jitsi Meet SDK and its dependencies
|
||||||
|
@ -39,16 +63,18 @@ pushd ${THIS_DIR}/../
|
||||||
./gradlew clean assembleRelease publish
|
./gradlew clean assembleRelease publish
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# The artifacts are now on the Maven repo, commit them
|
if [[ $MVN_HTTP == 0 ]]; then
|
||||||
pushd ${MVN_REPO}
|
# The artifacts are now on the Maven repo, commit them
|
||||||
if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" == "true" ]]; then
|
pushd ${MVN_REPO_PATH}
|
||||||
git add -A .
|
if [[ "$(git rev-parse --is-inside-work-tree 2>/dev/null)" == "true" ]]; then
|
||||||
git commit -m "Jitsi Meet SDK + dependencies"
|
git add -A .
|
||||||
fi
|
git commit -m "Jitsi Meet SDK + dependencies"
|
||||||
popd
|
fi
|
||||||
|
popd
|
||||||
|
|
||||||
# Tag the release
|
# Tag the release
|
||||||
git tag -a android-sdk-${SDK_VERSION}
|
git tag -a android-sdk-${SDK_VERSION}
|
||||||
|
fi
|
||||||
|
|
||||||
# Done!
|
# Done!
|
||||||
echo "Finished! Don't forget to push the tag and the Maven repo artifacts."
|
echo "Finished! Don't forget to push the tag and the Maven repo artifacts."
|
||||||
|
|
|
@ -201,6 +201,14 @@ publishing {
|
||||||
|
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
maven { url "file:${rootProject.ext.mavenRepo}" }
|
maven {
|
||||||
|
url rootProject.ext.mavenRepo
|
||||||
|
if (!rootProject.ext.mavenRepo.startsWith("file")) {
|
||||||
|
credentials {
|
||||||
|
username rootProject.ext.mavenUser
|
||||||
|
password rootProject.ext.mavenPassword
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue