mirror of
https://github.com/anyproto/anytype-kotlin.git
synced 2025-06-08 05:47:05 +09:00
Droid 66 CI/CD | Integrate distribution of debug nightly builds for testing into our CI pipeline (#2443)
This commit is contained in:
parent
cb85ff786d
commit
0056dae8a7
11 changed files with 131 additions and 6 deletions
34
.github/workflows/nightly-debug-builds.yml
vendored
Normal file
34
.github/workflows/nightly-debug-builds.yml
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
on:
|
||||
schedule:
|
||||
- cron: '59 23 * * *'
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [develop]
|
||||
name: Distribute nightly debug build
|
||||
jobs:
|
||||
setup-android:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Setup middleware dependency
|
||||
env:
|
||||
token_secret: ${{ secrets.ANYTYPE_SECRET }}
|
||||
user_secret: ${{ secrets.ANYTYPE_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: Enable dated version for night distribution build
|
||||
run: make enable_dated_version_name
|
||||
|
||||
- name: Decrypt secrets
|
||||
run: ./scripts/distribution/decrypt-secrets.sh
|
||||
env:
|
||||
ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY_FIREBASE_DISTRIBUTION }}
|
||||
|
||||
- name: Distribute debug build
|
||||
run: make distribute_debug
|
||||
|
||||
- name: Clean secrets
|
||||
if: always()
|
||||
run: ./scripts/distribution/clean-secrets.sh
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,6 +9,7 @@
|
|||
/github.properties
|
||||
/apikeys.properties
|
||||
/scripts/release/app-release.jks
|
||||
/scripts/distribution/anytype-debug-service-account-key.json
|
||||
.DS_Store
|
||||
**/build
|
||||
/libs
|
||||
|
|
9
Makefile
9
Makefile
|
@ -4,4 +4,11 @@ compile_android_test_sources:
|
|||
test_debug_all:
|
||||
./gradlew testDebugAll -q
|
||||
|
||||
pr_check: compile_android_test_sources test_debug_all
|
||||
enable_dated_version_name:
|
||||
./gradlew -q :app:enableDatedVersionName
|
||||
|
||||
distribute_debug:
|
||||
./gradlew bundleDebug appDistributionUploadDebug
|
||||
|
||||
pr_check: compile_android_test_sources test_debug_all
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ apply plugin: 'kotlin-android'
|
|||
apply plugin: 'kotlin-kapt'
|
||||
apply plugin: "androidx.navigation.safeargs.kotlin"
|
||||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
apply plugin: 'com.google.firebase.appdistribution'
|
||||
|
||||
apply from: "$rootDir/versioning.gradle"
|
||||
|
||||
|
@ -27,13 +28,13 @@ android {
|
|||
testInstrumentationRunner config.test_runner
|
||||
buildConfigField "boolean", "USE_NEW_WINDOW_INSET_API", "true"
|
||||
}
|
||||
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += ['LICENSE.txt', 'META-INF/DEPENDENCIES', 'META-INF/ASL2.0', 'META-INF/NOTICE', 'META-INF/LICENSE']
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
signingConfigs {
|
||||
release {
|
||||
if (useReleaseKeystore) {
|
||||
|
@ -67,6 +68,11 @@ android {
|
|||
debuggable true
|
||||
buildConfigField("String", "AMPLITUDE_KEY", apikeyProperties['amplitude.debug'])
|
||||
//signingConfig signingConfigs.debug
|
||||
firebaseAppDistribution {
|
||||
artifactType="AAB"
|
||||
groups="anytype-q&a"
|
||||
serviceCredentialsFile="$rootDir/scripts/distribution/anytype-debug-service-account-key.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
version.versionMajor=0
|
||||
version.versionMinor=9
|
||||
version.versionPatch=0
|
||||
version.useDatedVersionName=false
|
||||
|
|
|
@ -28,6 +28,7 @@ buildscript {
|
|||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
|
||||
classpath 'com.google.gms:google-services:4.3.10'
|
||||
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
|
||||
classpath 'com.google.firebase:firebase-appdistribution-gradle:3.0.2'
|
||||
classpath "org.jetbrains.dokka:dokka-gradle-plugin:${dokka_version}"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
classpath 'com.squareup.wire:wire-gradle-plugin:4.0.1'
|
||||
|
|
BIN
scripts/distribution/anytype-debug-service-account-key.gpg
Normal file
BIN
scripts/distribution/anytype-debug-service-account-key.gpg
Normal file
Binary file not shown.
4
scripts/distribution/clean-secrets.sh
Executable file
4
scripts/distribution/clean-secrets.sh
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Delete debug service account key
|
||||
rm -f scripts/distribution/anytype-debug-service-account-key.json
|
14
scripts/distribution/decrypt-secrets.sh
Executable file
14
scripts/distribution/decrypt-secrets.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
decrypt() {
|
||||
PASSPHRASE=$1
|
||||
INPUT=$2
|
||||
OUTPUT=$3
|
||||
gpg --quiet --batch --yes --decrypt --passphrase="$PASSPHRASE" --output $OUTPUT $INPUT
|
||||
}
|
||||
|
||||
if [[ ! -z "$ENCRYPT_KEY" ]]; then
|
||||
decrypt ${ENCRYPT_KEY} scripts/distribution/anytype-debug-service-account-key.gpg scripts/distribution/anytype-debug-service-account-key.json
|
||||
else
|
||||
echo "ENCRYPT_KEY is empty"
|
||||
fi
|
14
scripts/distribution/encrypt-secrets.sh
Executable file
14
scripts/distribution/encrypt-secrets.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
encrypt() {
|
||||
PASSPHRASE=$1
|
||||
INPUT=$2
|
||||
OUTPUT=$3
|
||||
gpg --batch --yes --passphrase="$PASSPHRASE" --cipher-algo AES256 --symmetric --output $OUTPUT $INPUT
|
||||
}
|
||||
|
||||
if [[ ! -z "$ENCRYPT_KEY" ]]; then
|
||||
encrypt ${ENCRYPT_KEY} scripts/distribution/anytype-debug-service-account-key.json scripts/distribution/anytype-debug-service-account-key.gpg
|
||||
else
|
||||
echo "ENCRYPT_KEY is empty"
|
||||
fi
|
|
@ -1,3 +1,5 @@
|
|||
import java.text.SimpleDateFormat
|
||||
|
||||
tasks.register("incrementVersionMajor") {
|
||||
doLast {
|
||||
incrementVersion true, false, false
|
||||
|
@ -16,6 +18,12 @@ tasks.register("incrementVersionPatch") {
|
|||
}
|
||||
}
|
||||
|
||||
tasks.register("enableDatedVersionName") {
|
||||
doLast {
|
||||
enableDatedVersionName()
|
||||
}
|
||||
}
|
||||
|
||||
def incrementVersion(maj, min, patch) {
|
||||
def versionMajor = getProperty('version.versionMajor').toInteger()
|
||||
def versionMinor = getProperty('version.versionMinor').toInteger()
|
||||
|
@ -56,20 +64,55 @@ def incrementVersion(maj, min, patch) {
|
|||
file.text = sb.toString()
|
||||
}
|
||||
|
||||
ext.getBuildVersionName = {
|
||||
def enableDatedVersionName() {
|
||||
def file = file('gradle.properties')
|
||||
def sb = new StringBuilder()
|
||||
|
||||
def versionMajor = getProperty('version.versionMajor').toInteger()
|
||||
def versionMinor = getProperty('version.versionMinor').toInteger()
|
||||
def versionPatch = getProperty('version.versionPatch').toInteger()
|
||||
|
||||
def name = "${versionMajor}.${versionMinor}.${versionPatch}"
|
||||
file.eachLine {line ->
|
||||
if(line.startsWith('version.versionMajor=')){
|
||||
sb.append("version.versionMajor=${versionMajor}")
|
||||
}else if(line.startsWith('version.versionMinor=')){
|
||||
sb.append("version.versionMinor=${versionMinor}")
|
||||
}else if(line.startsWith('version.versionPatch=')){
|
||||
sb.append("version.versionPatch=${versionPatch}")
|
||||
} else if(line.startsWith('version.useDatedVersionName=false')){
|
||||
sb.append("version.useDatedVersionName=true")
|
||||
}else{
|
||||
sb.append(line)
|
||||
}
|
||||
|
||||
return name
|
||||
sb.append(System.getProperty("line.separator"))
|
||||
}
|
||||
|
||||
file.text = sb.toString()
|
||||
}
|
||||
|
||||
ext.getBuildVersionName = {
|
||||
def versionMajor = getProperty('version.versionMajor').toInteger()
|
||||
def versionMinor = getProperty('version.versionMinor').toInteger()
|
||||
def versionPatch = getProperty('version.versionPatch').toInteger()
|
||||
def isDatedVersionNameEnabled = getProperty('version.useDatedVersionName').toBoolean()
|
||||
if (isDatedVersionNameEnabled) {
|
||||
def date = getCurrentDate()
|
||||
return "${versionMajor}.${versionMinor}.${versionPatch}-${date}"
|
||||
} else {
|
||||
return "${versionMajor}.${versionMinor}.${versionPatch}"
|
||||
}
|
||||
}
|
||||
|
||||
ext.getBuildVersionCode = {
|
||||
def versionMajor = getProperty('version.versionMajor').toInteger()
|
||||
def versionMinor = getProperty('version.versionMinor').toInteger()
|
||||
def versionPatch = getProperty('version.versionPatch').toInteger()
|
||||
|
||||
return versionMajor * 1000 + versionMinor * 100 + versionPatch
|
||||
}
|
||||
|
||||
static def getCurrentDate() {
|
||||
def date = new Date()
|
||||
def sdf = new SimpleDateFormat("MM-dd-yyyy")
|
||||
return sdf.format(date)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue