This commit is contained in:
ShirosakiMio 2024-01-16 13:53:43 +08:00
parent a48234b17a
commit 0470b780ca
2 changed files with 80 additions and 24 deletions

View File

@ -11,8 +11,13 @@ on:
jobs:
build:
strategy:
matrix:
arch: [ "all", "arm", "arm64", "x86", "x64" ]
fail-fast: false
env:
FCL_KEYSTORE_PASSWORD: ${{ secrets.FCL_KEYSTORE_PASSWORD }}
name: Build for ${{matrix.arch}}
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
@ -24,14 +29,14 @@ jobs:
with:
java-version: 17
- name: Build debug .apk
- name: Build debug ${{matrix.arch}} .apk
run: |
chmod +x gradlew
./gradlew assembleautobuild
./gradlew assembleautobuild -Darch=${{matrix.arch}}
- name : upload apk
- name: upload apk
uses: actions/upload-artifact@v3
with:
name: app-release
name: app-debug-${{matrix.arch}}
path: FCL/build/outputs/apk/autobuild/*
# retention-days: 1

View File

@ -8,11 +8,17 @@ android {
compileSdk 34
signingConfigs {
autoBuild {
FCLKey {
def pwd = System.getenv("FCL_KEYSTORE_PASSWORD")
if (pwd == null) {
Properties prop = new Properties()
prop.load(new FileInputStream("${rootDir}/local.properties"))
pwd = prop.get("pwd")
}
storeFile file("../key-store.jks")
storePassword System.getenv("FCL_KEYSTORE_PASSWORD")
storePassword pwd
keyAlias "FCL-Key"
keyPassword System.getenv("FCL_KEYSTORE_PASSWORD")
keyPassword pwd
}
}
@ -30,10 +36,11 @@ android {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.FCLKey
}
autobuild {
initWith debug
signingConfig signingConfigs.autoBuild
signingConfig signingConfigs.FCLKey
}
configureEach {
resValue "string", "app_version", "${defaultConfig.versionName}"
@ -41,7 +48,28 @@ android {
}
applicationVariants.configureEach { variant ->
variant.outputs.configureEach { output ->
outputFileName = "FCL-${variant.buildType.name}-${defaultConfig.versionName}.apk"
def abi = output.getFilter(ABI)
if (abi == null) {
abi = "all"
}
variant.mergeAssetsProvider.get().doLast {
def arch = System.getProperty("arch", "all")
def assetsDir = mergeAssetsProvider.get().outputDir.get()
def java = ['jre8', 'jre17']
println(arch)
java.forEach { String str ->
def runtimeDir = new File([assetsDir, "app_runtime/java/" + str].join(File.separator))
println(runtimeDir)
def files = fileTree(dir: runtimeDir, include: ['*.tar.xz'])
files.forEach { File file ->
if (arch != 'all' && !file.getName().contains(arch)) {
print("delete:${file} :")
println(delete(file))
}
}
}
}
outputFileName = "FCL-${variant.buildType.name}-${defaultConfig.versionName}-${abi}.apk"
}
}
compileOptions {
@ -53,6 +81,29 @@ android {
useLegacyPackaging true
}
}
splits {
def arch = System.getProperty("arch", "all")
if (arch != 'all') {
abi {
enable true
reset()
switch (arch) {
case 'arm':
include 'armeabi-v7a'
break
case 'arm64':
include 'arm64-v8a'
break
case 'x86':
include 'x86'
break
case 'x64':
include 'x86_64'
break
}
}
}
}
}
tasks.whenTaskAdded { Task task ->
@ -130,7 +181,7 @@ remotes {
user = prop.getProperty("sftp.username")
password = prop.getProperty("sftp.password")
}
} catch (Exception e) {
} catch (Exception ignored) {
}
}