Skip to content

Commit

Permalink
Use keystore.properties file for signing
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirtos committed Dec 1, 2024
1 parent ea23a75 commit 4a8321a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
distribution: 'temurin'
java-version: 11

- name: Decode Keystore
- name: Decode Keystore and create keystore.properties
env:
ENCODED_STRING: ${{ secrets.KEYSTORE_BASE_64 }}
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
Expand All @@ -40,20 +40,16 @@ jobs:

run: |
echo $ENCODED_STRING > keystore-b64.txt
base64 -d keystore-b64.txt > keystore.jks
base64 -d keystore-b64.txt > app/keystore.jks
echo "storePassword=$RELEASE_KEYSTORE_PASSWORD" >> keystore.properties
echo "keyPassword=$RELEASE_KEY_PASSWORD" >> keystore.properties
echo "keyAlias=$RELEASE_KEYSTORE_ALIAS" >> keystore.properties
echo "storeFile=keystore.jks" >> keystore.properties
- name: Build Release apk
env:
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
run: ./gradlew assembleRelease --stacktrace

- name: Build Release bundle
env:
RELEASE_KEYSTORE_PASSWORD: ${{ secrets.RELEASE_KEYSTORE_PASSWORD }}
RELEASE_KEYSTORE_ALIAS: ${{ secrets.RELEASE_KEYSTORE_ALIAS }}
RELEASE_KEY_PASSWORD: ${{ secrets.RELEASE_KEY_PASSWORD }}
run: ./gradlew bundleRelease --stacktrace

- name: Release
Expand Down
20 changes: 19 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ plugins {
id 'com.android.application'
}

// Create a variable called keystorePropertiesFile, and initialize it to your
// keystore.properties file, in the rootProject folder.
def keystorePropertiesFile = rootProject.file("keystore.properties")

// Initialize a new Properties() object called keystoreProperties.
def keystoreProperties = new Properties()

// Load your keystore.properties file into the keystoreProperties object.
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

android {
compileSdk 31
// last ndk version that supports deprecated architectures
Expand All @@ -15,7 +25,14 @@ android {
universalApk true
}
}

signingConfigs {
release {
storeFile file(keystoreProperties['storeFile'])
storePassword keystoreProperties['storePassword']
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
}
}

defaultConfig {
applicationId "com.wirtos.tguydroid"
Expand Down Expand Up @@ -51,6 +68,7 @@ android {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug {
debuggable true
Expand Down

0 comments on commit 4a8321a

Please sign in to comment.