Skip to content

Commit

Permalink
Experiments with github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
vipulyaara committed Feb 19, 2024
1 parent 7214351 commit 18ce1bb
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 1 deletion.
63 changes: 63 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Release Signing
run-name: Release Build Signing

on:
push:
branches:
- 'release_management'
permissions:
contents: write
jobs:
release-signing-build:
name: Release Signing Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Decode Keystore
env:
ENCODED_KEYSTORE: ${{ secrets.RELEASE_KEYSTORE_BASE64 }}
DECODED_KEYSTORE_PATH: ${{ secrets.RELEASE_KEYSTORE_PATH }}
run: |
echo $ENCODED_KEYSTORE > keystore_base64.txt
base64 -d keystore_base64.txt > $DECODED_KEYSTORE_PATH
- name: Sign and Build Release Bundle
env:
RELEASE_KEYSTORE_PATH: ${{ secrets.RELEASE_KEYSTORE_PATH }}
RELEASE_SIGNING_PASSWORD: ${{ secrets.RELEASE_SIGNING_PASSWORD }}
RELEASE_SIGNING_USERNAME: ${{ secrets.RELEASE_SIGNING_PASSWORD }}
RELEASE_SIGNING_ALIAS: ${{ secrets.RELEASE_SIGNING_ALIAS }}
run:
./gradlew assembleRelease

- name: Retrieve Version
run: |
echo "::set-output name=VERSION_NAME::$(${{github.workspace}}/gradlew -q versionname)"
id: android_version

- name: Get version
run: |
echo "version_name=${{steps.android_version.outputs.VERSION_NAME}}" >> $GITHUB_ENV
- name: Create Release on Github
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{env.version_name}}
name: Release - ${{env.version_name}}
generate_release_notes: true
prerelease: true
files: app/build/outputs/bundle/kafka/app-release.apk
11 changes: 10 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {
defaultConfig {
applicationId = "com.kafka.user"
versionCode = 52
versionName = "0.12.0"
versionName = libs.versions.versionname.toString()

val googleServerClientId: String = gradleLocalProperties(rootDir).getProperty("google_server_client_id")
val pipelessAuthToken: String = gradleLocalProperties(rootDir).getProperty("pipeless_auth_token")
Expand Down Expand Up @@ -51,6 +51,15 @@ android {
)
}

signingConfigs {
create("release") {
storeFile= file("keystore.jks")
storePassword = System.getenv("RELEASE_SIGNING_PASSWORD")
keyPassword = System.getenv("RELEASE_SIGNING_PASSWORD")
keyAlias = System.getenv("RELEASE_SIGNING_ALIAS")
}
}

buildTypes {
debug {
signingConfig = signingConfigs["debug"]
Expand Down
6 changes: 6 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,9 @@ fun Project.configureAndroidProject() {
}
}
}

tasks.register("appVersionName") {
doLast {
println(libs.versions.versionname)
}
}
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ androidx-baselineprofile = "1.2.3"
profileinstaller = "1.3.1"
review = "2.0.1"

versionname = "0.12.0"

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
Expand Down

0 comments on commit 18ce1bb

Please sign in to comment.