forked from melod1n/fast-messenger
update workflow to upload apks with build time in name
This commit is contained in:
@@ -32,17 +32,31 @@ jobs:
|
|||||||
- name: Build and sign release APK
|
- name: Build and sign release APK
|
||||||
run: ./gradlew assembleRelease
|
run: ./gradlew assembleRelease
|
||||||
|
|
||||||
- name: Upload release APK
|
- name: Find generated release APK name
|
||||||
|
id: find_apk
|
||||||
|
run: |
|
||||||
|
APK_PATH=$(find app/build/outputs/apk/release -name "*.apk" | head -n 1)
|
||||||
|
echo "APK_PATH=$APK_PATH" >> $GITHUB_ENV
|
||||||
|
echo "APK_NAME=$(basename $APK_PATH)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Upload APK with original name
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: app-release.apk
|
name: ${{ env.APK_NAME }}
|
||||||
path: app/build/outputs/apk/release/app-release.apk
|
path: ${{ env.APK_PATH }}
|
||||||
|
|
||||||
- name: Build and sign debug APK
|
- name: Build and sign debug APK
|
||||||
run: ./gradlew assembleDebug
|
run: ./gradlew assembleDebug
|
||||||
|
|
||||||
- name: Upload debug APK
|
- name: Find generated debug APK name
|
||||||
|
id: find_apk
|
||||||
|
run: |
|
||||||
|
APK_PATH=$(find app/build/outputs/apk/debug -name "*.apk" | head -n 1)
|
||||||
|
echo "APK_PATH=$APK_PATH" >> $GITHUB_ENV
|
||||||
|
echo "APK_NAME=$(basename $APK_PATH)" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Upload APK with original name
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: app-debug.apk
|
name: ${{ env.APK_NAME }}
|
||||||
path: app/build/outputs/apk/debug/app-debug.apk
|
path: ${{ env.APK_PATH }}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
|
||||||
import java.util.Properties
|
import java.util.Properties
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
@@ -58,6 +59,18 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
applicationVariants.all {
|
||||||
|
outputs.all {
|
||||||
|
val date = System.currentTimeMillis() / 1000
|
||||||
|
val buildType = buildType.name
|
||||||
|
val appVersion = versionName
|
||||||
|
val appVersionCode = versionCode
|
||||||
|
|
||||||
|
val newApkName = "app-$buildType-v$appVersion($appVersionCode)-$date.apk"
|
||||||
|
(this as? BaseVariantOutputImpl)?.outputFileName = newApkName
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
packaging {
|
packaging {
|
||||||
resources {
|
resources {
|
||||||
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
||||||
|
|||||||
Reference in New Issue
Block a user