mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
Analytics | Storing api keys (#1671)
This commit is contained in:
parent
c3fab7349b
commit
2e092aa035
5 changed files with 34 additions and 8 deletions
4
.github/workflows/check.yml
vendored
4
.github/workflows/check.yml
vendored
|
@ -13,6 +13,8 @@ jobs:
|
|||
env:
|
||||
token_secret: ${{ secrets.ANYTYPE_SECRET }}
|
||||
user_secret: ${{ secrets.ANYTYPE_USER_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret
|
||||
amplitude_secret: ${{ secrets.ANYTYPE_AMPLITUDE_SECRET }}
|
||||
amplitude_secret_debug: ${{ secrets.ANYTYPE_AMPLITUDE_DEBUG_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret $amplitude_secret $amplitude_secret_debug
|
||||
- name: Run unit tests
|
||||
run: ./gradlew assembleDebug test -Dpre-dex=false
|
||||
|
|
4
.github/workflows/workflow.yml
vendored
4
.github/workflows/workflow.yml
vendored
|
@ -11,6 +11,8 @@ jobs:
|
|||
env:
|
||||
token_secret: ${{ secrets.ANYTYPE_SECRET }}
|
||||
user_secret: ${{ secrets.ANYTYPE_USER_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret
|
||||
amplitude_secret: ${{ secrets.ANYTYPE_AMPLITUDE_SECRET }}
|
||||
amplitude_secret_debug: ${{ secrets.ANYTYPE_AMPLITUDE_DEBUG_SECRET }}
|
||||
run: ./middleware2.sh $token_secret $user_secret $amplitude_secret $amplitude_secret_debug
|
||||
- name: Run unit tests. Full mode.
|
||||
run: ./gradlew build test -Dpre-dex=false
|
||||
|
|
|
@ -8,6 +8,10 @@ apply plugin: 'com.google.firebase.crashlytics'
|
|||
|
||||
apply from: "$rootDir/versioning.gradle"
|
||||
|
||||
def apikeyPropertiesFile = rootProject.file("apikeys.properties")
|
||||
def apikeyProperties = new Properties()
|
||||
apikeyProperties.load(new FileInputStream(apikeyPropertiesFile))
|
||||
|
||||
android {
|
||||
def config = rootProject.extensions.getByName("ext")
|
||||
|
||||
|
@ -46,11 +50,13 @@ android {
|
|||
minifyEnabled false
|
||||
useProguard false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
buildConfigField("String", "AMPLITUDE_KEY", apikeyProperties['amplitude.release'])
|
||||
}
|
||||
|
||||
debug {
|
||||
applicationIdSuffix ".debug"
|
||||
debuggable true
|
||||
buildConfigField("String", "AMPLITUDE_KEY", apikeyProperties['amplitude.debug'])
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -59,10 +59,6 @@ class AndroidApplication : Application() {
|
|||
}
|
||||
|
||||
private fun setupAnalytics() {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Amplitude.getInstance().initialize(this, getString(R.string.amplitude_api_key_debug))
|
||||
} else {
|
||||
Amplitude.getInstance().initialize(this, getString(R.string.amplitude_api_key))
|
||||
}
|
||||
Amplitude.getInstance().initialize(this, BuildConfig.AMPLITUDE_KEY)
|
||||
}
|
||||
}
|
|
@ -2,9 +2,13 @@
|
|||
|
||||
TOKEN=$1
|
||||
USER=$2
|
||||
AMPLITUDE_RELEASE_KEY=$3
|
||||
AMPLITUDE_DEBUG_KEY=$4
|
||||
|
||||
GITHUB_USER_PROPERTY="gpr.usr"
|
||||
GITHUB_KEY_PROPERTY="gpr.key"
|
||||
AMPLITUDE_DEBUG_PROPERTY="amplitude.debug"
|
||||
AMPLITUDE_RELEASE_PROPERTY="amplitude.release"
|
||||
|
||||
if [ "$TOKEN" = "" ]; then
|
||||
echo "ERROR: token is empty"
|
||||
|
@ -16,8 +20,24 @@ if [ "$USER" = "" ]; then
|
|||
exit 1
|
||||
fi;
|
||||
|
||||
if [ "$AMPLITUDE_RELEASE_KEY" = "" ]; then
|
||||
echo "ERROR: amplitude.release is empty"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
if [ "$AMPLITUDE_DEBUG_KEY" = "" ]; then
|
||||
echo "ERROR: amplitude.debug is empty"
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
rm -rf github.properties
|
||||
touch github.properties
|
||||
|
||||
echo "$GITHUB_USER_PROPERTY=$USER" >> github.properties
|
||||
echo "$GITHUB_KEY_PROPERTY=$TOKEN" >> github.properties
|
||||
echo "$GITHUB_KEY_PROPERTY=$TOKEN" >> github.properties
|
||||
|
||||
rm -rf apikeys.properties
|
||||
touch apikeys.properties
|
||||
|
||||
echo "$AMPLITUDE_DEBUG_PROPERTY=\"$AMPLITUDE_DEBUG_KEY\"" >> apikeys.properties
|
||||
echo "$AMPLITUDE_RELEASE_PROPERTY=\"$AMPLITUDE_RELEASE_KEY\"" >> apikeys.properties
|
Loading…
Add table
Add a link
Reference in a new issue