Skip to content

Commit

Permalink
Support signing APK
Browse files Browse the repository at this point in the history
  • Loading branch information
wborn committed Apr 22, 2024
1 parent dfa5717 commit 65854e1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,18 @@ jobs:
- name: Run assemble
if: ${{ !steps.is_main_repo.outputs.value || github.event_name == 'pull_request' }}
run: |
cd GenericApp
gradle assemble
gradle assemble -p GenericApp
- name: Run assemble and publish
if: ${{ steps.is_main_repo.outputs.value && github.event_name != 'pull_request' }}
run: |
command="gradle assemble publish -PsigningKey=$SIGNING_KEY -PsigningPassword=$SIGNING_PASSWORD -PpublishUsername=$MAVEN_USERNAME -PpublishPassword=$MAVEN_PASSWORD"
echo "$KEYSTORE_BASE64" | base64 -d > keystore
command="gradle assemble publish -p GenericApp"
command="$command -PsigningKey=$SIGNING_KEY -PsigningPassword=$SIGNING_PASSWORD -PpublishUsername=$MAVEN_USERNAME -PpublishPassword=$MAVEN_PASSWORD"
command="$command -PkeystoreKeyAlias=$KEYSTORE_KEY_ALIAS -PkeystoreKeyPassword=$KEYSTORE_KEY_PASSWORD -PkeystoreFile=$PWD/keystore -PkeystorePassword=$KEYSTORE_PASSWORD"
if [ "$EVENT_NAME" == "release" ]; then
command="$command -PappVersion=$MAVEN_TAG -PorlibVersion=$MAVEN_TAG"
fi
cd GenericApp
$command
env:
EVENT_NAME: ${{ github.event_name }}
Expand All @@ -75,6 +76,11 @@ jobs:
MAVEN_USERNAME: ${{ secrets._TEMP_MAVEN_USERNAME || secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets._TEMP_MAVEN_PASSWORD || secrets.MAVEN_PASSWORD }}
MAVEN_TAG: ${{ github.ref_name }}
KEYSTORE_BASE64: |
${{ secrets.ANDROID_KEYSTORE_BASE64 }}
KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
KEYSTORE_KEY_ALIAS: ${{ secrets.ANDROID_KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_KEY_PASSWORD }}

- name: Upload build outputs
if: success()
Expand Down
16 changes: 15 additions & 1 deletion GenericApp/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,24 @@ android {
resValue "string", "NOTIFICATION_CHANNEL_ID", applicationId + ".ORAppMessage"
}

if (project.hasProperty("keystoreFile")) {
signingConfigs {
release {
keyAlias keystoreKeyAlias
keyPassword keystoreKeyPassword
storeFile file(keystoreFile)
storePassword keystorePassword
}
}
}

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
if (project.hasProperty("keystoreFile")) {
signingConfig signingConfigs.release
}
}
}

Expand Down Expand Up @@ -75,7 +89,7 @@ afterEvaluate {
release(MavenPublication) {
from components.release

artifact source: file('build/outputs/apk/release/app-release-unsigned.apk')
artifact source: file('build/outputs/apk/release/app-release.apk')
artifact sourcesJar

group = "io.openremote"
Expand Down

0 comments on commit 65854e1

Please sign in to comment.