change App ID for PRs on Android to avoid replacing release

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2019-02-11 22:24:36 +01:00
parent 3617fefbe9
commit 6a7efb8339
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
9 changed files with 88 additions and 14 deletions

View File

@ -5,8 +5,10 @@ apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.grad
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* The react.gradle file registers a task for each build variant:
* - bundlePrJsAndAssets
* - bundleDebugJsAndAssets
* - bundleReleaseJsAndAssets
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
@ -75,7 +77,8 @@ import com.android.build.OutputFile
*/
project.ext.react = [
nodeExecutableAndArgs: ["node", "--max-old-space-size=8192"],
entryFile: "index.android.js"
entryFile: "index.android.js",
bundleInPr: true,
]
apply from: "../../node_modules/react-native/react.gradle"
@ -203,6 +206,13 @@ android {
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
pr {
initWith release
applicationIdSuffix ".pr"
versionNameSuffix ".pr"
resValue "string", "app_name", "Status PR"
matchingFallbacks = ["debug", "release"]
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->

View File

@ -1,5 +1,4 @@
<resources>
<string name="app_name">Status</string>
<string name="root_warning">Your phone appears to be ROOTED, by pressing CONTINUE you understand and accept the risks in using this software.</string>
<string name="root_okay">Continue</string>
<string name="root_cancel">Exit</string>

View File

@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<!-- These are added by React Native for debug mode, but actually aren't needed in release mode -->
<uses-permission tools:node="remove" android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
</manifest>

View File

@ -0,0 +1,42 @@
{
"project_info": {
"project_number": "854811651919",
"firebase_url": "https://status-react-app.firebaseio.com",
"project_id": "status-react-app",
"storage_bucket": "status-react-app.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:854811651919:android:11ee7444ded8a00a",
"android_client_info": {
"package_name": "im.status.ethereum.pr"
}
},
"oauth_client": [
{
"client_id": "854811651919-gua52csicclb5p9gr4eeu33ukk0aaphj.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAOF4W1j8GYeXzzVKRfNKlXywD6bx0rJtQ"
}
],
"services": {
"analytics_service": {
"status": 1
},
"appinvite_service": {
"status": 1,
"other_platform_oauth_client": []
},
"ads_service": {
"status": 2
}
}
}
],
"configuration_version": "1"
}

View File

@ -0,0 +1,3 @@
<resources>
<string name="app_name">Status PR</string>
</resources>

View File

@ -0,0 +1,3 @@
<resources>
<string name="app_name">Status</string>
</resources>

View File

@ -3,9 +3,16 @@ cmn = load 'ci/common.groovy'
def bundle(type = 'nightly') {
/* Disable Gradle Daemon https://stackoverflow.com/questions/38710327/jenkins-builds-fail-using-the-gradle-daemon */
def gradleOpt = "-PbuildUrl='${currentBuild.absoluteUrl}' -Dorg.gradle.daemon=false "
if (type == 'release') {
def target = "release"
if (type in ['pr', 'e2e']) {
/* PR builds shouldn't replace normal releases */
target = 'pr'
} else if (type == 'release') {
gradleOpt += "-PreleaseVersion='${cmn.version()}'"
}
env.APK_PATH = "android/app/build/outputs/apk/${target}/app-${target}.apk"
dir('android') {
withCredentials([
string(
@ -18,11 +25,11 @@ def bundle(type = 'nightly') {
passwordVariable: 'STATUS_RELEASE_KEY_PASSWORD'
)
]) {
sh "./gradlew assembleRelease ${gradleOpt}"
sh "./gradlew assemble${target.capitalize()} ${gradleOpt}"
}
}
def pkg = cmn.pkgFilename(type, 'apk')
sh "cp android/app/build/outputs/apk/release/app-release.apk ${pkg}"
sh "cp ${env.APK_PATH} ${pkg}"
return pkg
}

View File

@ -226,12 +226,15 @@ end
platform :android do
# Optional env variables
APK_PATH = ENV["APK_PATH"] || "android/app/build/outputs/apk/release/app-release.apk"
desc "Deploy a new internal build to Google Play"
desc "expects GOOGLE_PLAY_JSON_KEY environment variable"
lane :nightly do
upload_to_play_store(
track: "internal",
apk: "android/app/build/outputs/apk/release/app-release.apk",
apk: APK_PATH,
json_key_data: ENV["GOOGLE_PLAY_JSON_KEY"]
)
@ -242,7 +245,7 @@ platform :android do
lane :release do
upload_to_play_store(
track: "alpha",
apk: "android/app/build/outputs/apk/release/app-release.apk",
apk: APK_PATH,
json_key_data: ENV["GOOGLE_PLAY_JSON_KEY"]
)
end
@ -266,7 +269,7 @@ platform :android do
desc "---"
desc "Output: writes `fastlane/diawi.out` file url of the uploded file"
lane :upload_diawi do
upload_to_diawi("android/app/build/outputs/apk/release/app-release.apk")
upload_to_diawi(APK_PATH)
end
desc "`fastlane android saucelabs` - upload .apk to sauce labs"
@ -277,7 +280,7 @@ platform :android do
desc "will fails if file isn't there"
lane :saucelabs do
upload_to_saucelabs(
"android/app/build/outputs/apk/release/app-release.apk"
APK_PATH
)
end
end