Generate manifest as part of gradle build (#64)
This commit is contained in:
parent
245243eedd
commit
3a4515268e
15
.github/workflows/android.yml
vendored
15
.github/workflows/android.yml
vendored
@ -14,6 +14,9 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
|
- name: Extract tag name
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
||||||
- name: Set up environment variables
|
- name: Set up environment variables
|
||||||
run: |
|
run: |
|
||||||
echo "GPR_USER=${{ github.actor }}" >> $GITHUB_ENV
|
echo "GPR_USER=${{ github.actor }}" >> $GITHUB_ENV
|
||||||
@ -22,7 +25,7 @@ jobs:
|
|||||||
echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> $GITHUB_ENV
|
echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> $GITHUB_ENV
|
||||||
echo "KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}" >> $GITHUB_ENV
|
echo "KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}" >> $GITHUB_ENV
|
||||||
echo "KEYSTORE_BASE64=${{ secrets.KEYSTORE_BASE64 }}" >> $GITHUB_ENV
|
echo "KEYSTORE_BASE64=${{ secrets.KEYSTORE_BASE64 }}" >> $GITHUB_ENV
|
||||||
|
echo "BUILD_NUMBER=${{ github.run_number }}" >> $GITHUB_ENV
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: set up JDK 17
|
- name: set up JDK 17
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
@ -36,11 +39,11 @@ jobs:
|
|||||||
- name: Build with Gradle
|
- name: Build with Gradle
|
||||||
run: ./gradlew build
|
run: ./gradlew build
|
||||||
|
|
||||||
# - name: Archive APK
|
- name: Archive APK
|
||||||
# uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
# with:
|
with:
|
||||||
# name: app-release.apk
|
name: app-release.apk
|
||||||
# path: app/build/outputs/apk/release/app-release.apk
|
path: app/build/outputs/apk/release/app-release.apk
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
|
|||||||
@ -15,8 +15,8 @@ android {
|
|||||||
applicationId = "de.timklge.karooheadwind"
|
applicationId = "de.timklge.karooheadwind"
|
||||||
minSdk = 26
|
minSdk = 26
|
||||||
targetSdk = 35
|
targetSdk = 35
|
||||||
versionCode = 15
|
versionCode = 100 + (System.getenv("BUILD_NUMBER")?.toInt() ?: 1)
|
||||||
versionName = "1.3.1"
|
versionName = System.getenv("RELEASE_VERSION") ?: "1.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
signingConfigs {
|
signingConfigs {
|
||||||
@ -51,9 +51,40 @@ android {
|
|||||||
}
|
}
|
||||||
buildFeatures {
|
buildFeatures {
|
||||||
compose = true
|
compose = true
|
||||||
|
buildConfig = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.register("generateManifest") {
|
||||||
|
description = "Generates manifest.json with current version information"
|
||||||
|
group = "build"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
val manifestFile = file("$projectDir/manifest.json")
|
||||||
|
val manifest = mapOf(
|
||||||
|
"label" to "karoo-headwind",
|
||||||
|
"packageName" to "de.timklge.karooheadwind",
|
||||||
|
"iconUrl" to "https://github.com/timklge/karoo-headwind/releases/latest/download/karoo-headwind.png",
|
||||||
|
"latestApkUrl" to "https://github.com/timklge/karoo-headwind/releases/latest/download/app-release.apk",
|
||||||
|
"latestVersion" to android.defaultConfig.versionName,
|
||||||
|
"latestVersionCode" to android.defaultConfig.versionCode,
|
||||||
|
"developer" to "timklge",
|
||||||
|
"description" to "Provides headwind direction, wind speed and other weather data fields.",
|
||||||
|
"releaseNotes" to "* Show current weather in app menu\n" +
|
||||||
|
"* Add individual forecast fields\n" +
|
||||||
|
"* Fix distance update in route forecast"
|
||||||
|
)
|
||||||
|
|
||||||
|
val gson = groovy.json.JsonBuilder(manifest).toPrettyString()
|
||||||
|
manifestFile.writeText(gson)
|
||||||
|
println("Generated manifest.json with version ${android.defaultConfig.versionName} (${android.defaultConfig.versionCode})")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named("assemble") {
|
||||||
|
dependsOn("generateManifest")
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(libs.mapbox.sdk.turf)
|
implementation(libs.mapbox.sdk.turf)
|
||||||
implementation(libs.hammerhead.karoo.ext)
|
implementation(libs.hammerhead.karoo.ext)
|
||||||
|
|||||||
@ -1,11 +0,0 @@
|
|||||||
{
|
|
||||||
"label": "karoo-headwind",
|
|
||||||
"packageName": "de.timklge.karooheadwind",
|
|
||||||
"iconUrl": "https://github.com/timklge/karoo-headwind/releases/latest/download/karoo-headwind.png",
|
|
||||||
"latestApkUrl": "https://github.com/timklge/karoo-headwind/releases/latest/download/app-release.apk",
|
|
||||||
"latestVersion": "1.3.1",
|
|
||||||
"latestVersionCode": 15,
|
|
||||||
"developer": "timklge",
|
|
||||||
"description": "Provides headwind direction, wind speed and other weather data fields",
|
|
||||||
"releaseNotes": "* Add individual forecast fields\n* Fix forecast along route distance update"
|
|
||||||
}
|
|
||||||
@ -54,7 +54,7 @@ import kotlin.math.roundToInt
|
|||||||
import kotlin.time.Duration.Companion.hours
|
import kotlin.time.Duration.Companion.hours
|
||||||
import kotlin.time.Duration.Companion.minutes
|
import kotlin.time.Duration.Companion.minutes
|
||||||
|
|
||||||
class KarooHeadwindExtension : KarooExtension("karoo-headwind", "1.3.1") {
|
class KarooHeadwindExtension : KarooExtension("karoo-headwind", BuildConfig.VERSION_NAME) {
|
||||||
companion object {
|
companion object {
|
||||||
const val TAG = "karoo-headwind"
|
const val TAG = "karoo-headwind"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user