Add github build action
This commit is contained in:
parent
a2ee609abc
commit
6d2d8a77a1
55
.github/workflows/android.yml
vendored
Normal file
55
.github/workflows/android.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
tags: [ "*" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Set up environment variables
|
||||
run: |
|
||||
echo "GPR_USER=${{ github.actor }}" >> $GITHUB_ENV
|
||||
echo "GPR_KEY=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
|
||||
echo "KEY_ALIAS=${{ secrets.KEY_ALIAS }}" >> $GITHUB_ENV
|
||||
echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> $GITHUB_ENV
|
||||
echo "KEYSTORE_PASSWORD=${{ secrets.KEYSTORE_PASSWORD }}" >> $GITHUB_ENV
|
||||
echo "KEYSTORE_BASE64=${{ secrets.KEYSTORE_BASE64 }}" >> $GITHUB_ENV
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- name: set up JDK 17
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
cache: gradle
|
||||
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
|
||||
- name: Archive APK
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: app-release
|
||||
path: app/build/outputs/apk/release/app-release.apk
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
with:
|
||||
name: ${{ github.ref_name }}
|
||||
prerelease: false
|
||||
generateReleaseNotes: true
|
||||
artifacts: app/build/outputs/apk/release/app-release.apk, app/manifest.json, app/karoo-powerbar.png
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@ -1,5 +1,7 @@
|
||||
# Karoo Powerbar Extension
|
||||
|
||||
[](https://github.com/timklge/karoo-powerbar/actions/workflows/android.yml)
|
||||
|
||||
Simple karoo extension that shows an overlay power bar at the edge of the screen. For Karoo 2 and Karoo 3 devices.
|
||||
|
||||

|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import java.util.Base64
|
||||
|
||||
plugins {
|
||||
alias(libs.plugins.android.application)
|
||||
alias(libs.plugins.jetbrains.kotlin.android)
|
||||
@ -17,9 +19,26 @@ android {
|
||||
versionName = "1.2.1"
|
||||
}
|
||||
|
||||
signingConfigs {
|
||||
create("release") {
|
||||
val env: MutableMap<String, String> = System.getenv()
|
||||
keyAlias = env["KEY_ALIAS"]
|
||||
keyPassword = env["KEY_PASSWORD"]
|
||||
|
||||
val base64keystore: String = env["KEYSTORE_BASE64"] ?: ""
|
||||
val keystoreFile: File = File.createTempFile("keystore", ".jks")
|
||||
keystoreFile.writeBytes(Base64.getDecoder().decode(base64keystore))
|
||||
storeFile = keystoreFile
|
||||
storePassword = env["KEYSTORE_PASSWORD"]
|
||||
}
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
debug {
|
||||
isMinifyEnabled = false
|
||||
}
|
||||
release {
|
||||
signingConfig = signingConfigs.getByName("release")
|
||||
// isMinifyEnabled = false
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,8 +16,11 @@ pluginManagement {
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
val gprUser = getLocalProperty("gpr.user")
|
||||
val gprKey = getLocalProperty("gpr.key")
|
||||
|
||||
val env: MutableMap<String, String> = System.getenv()
|
||||
val gprUser = if(env.containsKey("GPR_USER")) env["GPR_USER"] else getLocalProperty("gpr.user")
|
||||
val gprKey = if(env.containsKey("GPR_KEY")) env["GPR_KEY"] else getLocalProperty("gpr.key")
|
||||
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user