Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…cache-android into develop
  • Loading branch information
jclark118 committed Nov 2, 2023
2 parents 4b9dc92 + 51b653f commit cb74a7e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 34 deletions.
29 changes: 16 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
with:
java-version: 16
distribution: 'adopt'
- name: Setup Keystore
run: |
echo "${{ secrets.SIGNING_KEY }}" > release.b64
base64 -d release.b64 > release.keystore
- name: mobsfscan
uses: MobSF/mobsfscan@0.2.0
with:
Expand All @@ -24,21 +28,20 @@ jobs:
with:
sarif_file: results.sarif
- name: Build with Gradle
run: ./gradlew assembleRelease -PRELEASE_MAPS_MAPCACHE_API_KEY=${{ secrets.RELEASE_MAPS_MAPCACHE_API_KEY }}
- name: Sign APK
uses: noriban/sign-android-release@v4
with:
releaseDirectory: mapcache/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
- name: Copy Release Artifacts
run: |
mkdir mapcache/build/release
cp mapcache/build/outputs/apk/release/mapcache-*-signed.apk "mapcache/build/release/mapcache-$(./gradlew mapcache:androidAppVersion | grep versionName | sed 's/^.*@//').apk"
./gradlew clean assembleRelease \
-PKEYSTORE=../release.keystore \
-PKEYSTORE_PASSWORD=${{ secrets.KEY_STORE_PASSWORD }} \
-PKEY_ALIAS=${{ secrets.ALIAS }} \
-PKEY_PASSWORD=${{ secrets.KEY_PASSWORD }} \
-PRELEASE_MAPS_MAPCACHE_API_KEY=${{ secrets.RELEASE_MAPS_MAPCACHE_API_KEY }}
- name: Verify Signature
run: $ANDROID_SDK_ROOT/build-tools/33.0.1/apksigner verify --print-certs mapcache/build/outputs/apk/release/mapcache.apk
- name: List files in the repository
run: |
ls -R ${{ github.workspace }}
- name: Upload Artifacts
uses: actions/upload-artifact@v1
with:
name: mapcache
path: mapcache/build/release
path: mapcache/build/outputs/apk/release/mapcache.apk
41 changes: 20 additions & 21 deletions mapcache/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,28 @@ android {
versionName '2.1.11'
multiDexEnabled true
}
signingConfigs {
release {
if (project.hasProperty('KEYSTORE')) {
println 'assigning keystore'
storeFile file(KEYSTORE)
storePassword KEYSTORE_PASSWORD
keyAlias KEY_ALIAS
keyPassword KEY_PASSWORD
} else {
println 'no keystore property configured'
}
}
}
buildTypes {
release {
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "mapcache.apk"
}
}
minifyEnabled false
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
resValue "string", "GOOGLE_MAPS_ANDROID_API_KEY", googleMapsApiReleaseKey
}
Expand Down Expand Up @@ -91,26 +110,6 @@ dependencies {
testImplementation 'androidx.test:rules:1.5.0'
}

configure extensions.android, {
if (project.hasProperty('RELEASE_STORE_FILE') && new File((String) project.getProperty('RELEASE_STORE_FILE')).exists()) {
signingConfigs {
release {
storeFile file(RELEASE_STORE_FILE)
storePassword RELEASE_STORE_PASSWORD
keyAlias RELEASE_KEY_ALIAS
keyPassword RELEASE_KEY_PASSWORD
}
}
buildTypes {
release {
setSigningConfig(signingConfigs.release)
}
}
} else {
println 'no keystore configured'
}
}

// This is to fix the errors : java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
configurations.all {
resolutionStrategy.eachDependency { details ->
Expand All @@ -123,4 +122,4 @@ configurations.all {
}
}

apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android'

0 comments on commit cb74a7e

Please sign in to comment.