Skip to content

Commit

Permalink
Merge pull request #65 from boschglobal/feature-64
Browse files Browse the repository at this point in the history
Provide Signed .apk for TestApp
  • Loading branch information
Chrylo authored Dec 14, 2023
2 parents 87f7fe9 + 3bcd066 commit bbaa0f0
Show file tree
Hide file tree
Showing 11 changed files with 174 additions and 42 deletions.
38 changes: 38 additions & 0 deletions .github/actions/create-release-apk/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Release apk
description: Decodes any provided Keystore and creates a signed .apk with this.

inputs:
keystore:
description: "Keystore Base64 encoded"
required: true
key_alias:
description: "Keystore alias"
required: true
key_password:
description: "Keystore password"
required: true
store_password:
description: "Store password"
required: true
gradle_task:
description: "Gradle Task to execute"
required: false
default: assembleRelease

runs:
using: "composite"
steps:
- name: Decode Keystore
uses: timheuer/base64-to-file@v1
with:
fileName: 'keystore.jks'
encodedString: ${{ inputs.keystore }}

- name: Create .apk file
env:
SIGNING_KEY_ALIAS: ${{ inputs.key_alias }}
SIGNING_KEY_PASSWORD: ${{ inputs.key_password }}
SIGNING_STORE_PASSWORD: ${{ inputs.store_password }}
KEYSTORE_PATH: ${{ runner.temp }}/keystore.jks
shell: bash
run: ./gradlew ${{ inputs.gradle_task }}
13 changes: 13 additions & 0 deletions .github/actions/setup-project/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Setup project
description: Setups the gradle and java environment

runs:
using: "composite"
steps:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
46 changes: 46 additions & 0 deletions .github/workflows/build-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Build Main

on:
push:
branches:
- main

jobs:
build-project:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Project
uses: ./.github/actions/setup-project

- name: Update Version
run: npm run bump-release # Updates the semantic version depending on the last commits e.g. feature / bugfix

- name: Set Snapshot Version
run: ./gradlew setSnapshotVersion # Do not chain this command because it writes into a file which needs to be re-read inside the next gradle command

- name: Build SDK TestApp
uses: ./.github/actions/create-release-apk
with:
keystore: ${{ secrets.KEYSTORE_DEBUG }}
key_alias: ${{ secrets.SIGNING_KEY_ALIAS }}
key_password: ${{ secrets.SIGNING_KEY_PASSWORD }}
store_password: ${{ secrets.SIGNING_STORE_PASSWORD }}
gradle_task: app:assembleRelease

- name: Archive .apk file
uses: actions/upload-artifact@v3
with:
name: kuksa_sdk_testapp.apk
path: app/build/outputs/apk/release/app-release.apk
if-no-files-found: error
retention-days: 14

- name: Archive changelog
uses: actions/upload-artifact@v3
with:
name: CHANGELOG.md
path: CHANGELOG.md
retention-days: 14
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: Validate Pull Request

on:
pull_request
Expand All @@ -7,23 +7,17 @@ jobs:
build-project:
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3

- name: "Run Docker Container of Databroker in detached mode"
run: docker run --pull=always --rm --publish 55556:55556/tcp --detach --name databroker ghcr.io/eclipse/kuksa.val/databroker:master --port 55556 --insecure

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Project
uses: ./.github/actions/setup-project

- name: Run 'assemble' with Gradle Wrapper
run: ./gradlew assemble
- name: Run 'assembleDebug' with Gradle Wrapper
run: ./gradlew assembleDebug

- name: Run 'lint' with Gradle Wrapper
run: ./gradlew ktlintCheck detekt
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: spdx
name: SPDX License Check

on:
pull_request
Expand All @@ -7,7 +7,6 @@ jobs:
check-spdx-headers:
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3
with:
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: commitlint
name: Commitlint

on:
pull_request
Expand All @@ -7,7 +7,6 @@ jobs:
commitlint:
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3

Expand Down
12 changes: 3 additions & 9 deletions .github/workflows/dash.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: dash
name: Dash License Check

on:
pull_request
Expand All @@ -7,17 +7,11 @@ jobs:
check-dash:
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Project
uses: ./.github/actions/setup-project

- name: Create Dash Dependency Report
run: ./gradlew mergeDashFiles
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/deploy-release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: deploy-release
name: Deploy Release SDK

concurrency: production

Expand All @@ -15,13 +15,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Project
uses: ./.github/actions/setup-project

- name: Set Release Version
run: ./gradlew setReleaseVersion # Do not chain this command because it writes into a file which needs to be re-read inside the next gradle command
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/deploy-snapshot.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: deploy-snapshot
name: Deploy Snapshot SDK

concurrency: production
concurrency: snapshot

on:
push:
Expand All @@ -15,13 +15,8 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Setup Project
uses: ./.github/actions/setup-project

- name: Update Version
run: npm run bump-release # Updates the semantic version depending on the last commits e.g. feature / bugfix
Expand All @@ -36,4 +31,4 @@ jobs:
ORG_GPG_PRIVATE_KEY: ${{ secrets.ORG_GPG_PRIVATE_KEY }}
ORG_OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }}
ORG_OSSRH_USERNAME: ${{ secrets.ORG_OSSRH_USERNAME }}
run: ./gradlew --stacktrace publishAllPublicationsToOSSRHSnapshotRepository
run: ./gradlew publishAllPublicationsToOSSRHSnapshotRepository
24 changes: 24 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.eclipse.kuksa.property.PropertiesLoader

/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
Expand Down Expand Up @@ -59,6 +61,24 @@ android {
useSupportLibrary = true
}
}
signingConfigs {
create("release") {
val propertiesLoader = PropertiesLoader()
val localProperties = propertiesLoader.load("$rootDir/local.properties")

val keystorePath = System.getenv("KEYSTORE_PATH") ?: localProperties?.getProperty("release.keystore.path")
println("Defined keystore path: $keystorePath")
if (keystorePath == null) return@create

storeFile = File(keystorePath)
keyAlias = System.getenv("SIGNING_KEY_ALIAS")
?: localProperties?.getProperty("release.keystore.key.alias")
keyPassword = System.getenv("SIGNING_KEY_PASSWORD")
?: localProperties?.getProperty("release.keystore.key.password")
storePassword = System.getenv("SIGNING_STORE_PASSWORD")
?: localProperties?.getProperty("release.keystore.store.password")
}
}
buildTypes {
// for local builds, used to find shrinking issues
val isMinify = project.hasProperty("minify")
Expand All @@ -75,6 +95,10 @@ android {
)
}
}

release {
signingConfig = signingConfigs.getByName("release")
}
}
namespace = "org.eclipse.kuksa.testapp"
lint {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2023 Contributors to the Eclipse Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/

package org.eclipse.kuksa.property

import java.io.File
import java.util.Properties

class PropertiesLoader {
fun load(path: String): Properties? {
val properties = File(path)
if (!properties.exists()) return null

properties.reader().use { reader ->
return Properties().apply {
load(reader)
}
}
}
}

0 comments on commit bbaa0f0

Please sign in to comment.