GitHub Workflows switched to Release

This commit is contained in:
Ash 2022-04-20 01:36:34 +08:00
parent 423b48bb08
commit 8564938b1f
5 changed files with 40 additions and 6 deletions

View File

@ -1,20 +1,28 @@
name: "Build + Upload artifacts" name: "Build Commit"
on: push on: push
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2 - uses: actions/setup-java@v2
with: with:
distribution: temurin distribution: temurin
java-version: 11 java-version: 11
- uses: actions/checkout@v2
- name: Checkout Android Keystore
uses: actions/checkout@v2
with:
repository: Ashinch/ReadYouSecret
token: ${{ secrets.ReadYouSecretToken }}
path: ReadYouSecret
ref: main
- uses: gradle/gradle-build-action@v2 - uses: gradle/gradle-build-action@v2
- run: gradle assembleDebug - run: gradle assembleRelease
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: ${{ github.sha }} name: ${{ github.sha }}
path: app/build/outputs/apk/debug/app-debug.apk path: app/build/outputs/apk/release/*.apk

3
.gitignore vendored
View File

@ -15,6 +15,7 @@ gen/
# Gradle files # Gradle files
.gradle/ .gradle/
build/ build/
release/
# Local configuration file (sdk path, etc) # Local configuration file (sdk path, etc)
local.properties local.properties
@ -25,7 +26,7 @@ proguard/
# Log Files # Log Files
*.log *.log
# Android Studio Navigation editor temp files # Android Studio
.navigation/ .navigation/
# Android Studio captures folder # Android Studio captures folder

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "ReadYouSecret"]
path = ReadYouSecret
url = git@github.com:Ashinch/ReadYouSecret.git

1
ReadYouSecret Submodule

@ -0,0 +1 @@
Subproject commit dae3bdcacacc75eecb43a93b97238adaa8dae539

View File

@ -6,6 +6,14 @@ plugins {
id "androidx.navigation.safeargs.kotlin" id "androidx.navigation.safeargs.kotlin"
} }
def gitCommitHash = 'git rev-parse --verify --short HEAD'.execute().text.trim()
def keyProps = new Properties()
def keyPropsFile = rootProject.file('ReadYouSecret/keystore.properties')
if (keyPropsFile.exists()) {
println("Loading keystore properties from ${keyPropsFile.absolutePath}")
keyProps.load(new FileInputStream(keyPropsFile))
}
android { android {
compileSdk 32 compileSdk 32
@ -21,12 +29,25 @@ android {
useSupportLibrary true useSupportLibrary true
} }
} }
signingConfigs {
release {
keyAlias keyProps['keyAlias']
keyPassword keyProps['keyPassword']
storeFile keyProps['storeFile'] ? file(keyProps['storeFile']) : null
storePassword keyProps['storePassword']
}
}
buildTypes { buildTypes {
release { release {
minifyEnabled true minifyEnabled true
shrinkResources true shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
applicationVariants.all { variant ->
variant.outputs.each { output ->
output.outputFileName = "ReadYou-${defaultConfig.versionName}-${gitCommitHash}.apk"
} }
} }
kotlinOptions { kotlinOptions {