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
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: temurin
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
- run: gradle assembleDebug
- run: gradle assembleRelease
- uses: actions/upload-artifact@v3
with:
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/
build/
release/
# Local configuration file (sdk path, etc)
local.properties
@ -25,7 +26,7 @@ proguard/
# Log Files
*.log
# Android Studio Navigation editor temp files
# Android Studio
.navigation/
# 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"
}
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 {
compileSdk 32
@ -21,12 +29,25 @@ android {
useSupportLibrary true
}
}
signingConfigs {
release {
keyAlias keyProps['keyAlias']
keyPassword keyProps['keyPassword']
storeFile keyProps['storeFile'] ? file(keyProps['storeFile']) : null
storePassword keyProps['storePassword']
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
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 {