Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/publish-playstore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish to Play Store

on:
workflow_dispatch:
inputs:
track:
description: "Play Store track"
required: true
default: "internal"
type: choice
options:
- internal
- alpha
- beta
- production
jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17

- name: Decode Play Store service account
run: echo "$PLAY_STORE_JSON_KEY" > play-store-key.json
env:
PLAY_STORE_JSON_KEY: ${{ secrets.PLAY_STORE_JSON_KEY }}

- name: Build Release AAB
run: ./gradlew bundleRelease

- name: Sign APK
id: sign_app
uses: ilharp/sign-android-release@nightly
with:
releaseDir: app/build/outputs/bundle/release
signingKey: ${{ secrets.SIGNING_KEY }}
keyAlias: ${{ secrets.ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
buildToolsVersion: ${{ env.ANDROID_BUILD_TOOLS_VERSION }}


- name: Upload APK artifact
uses: actions/upload-artifact@v7
with:
name: app-release.aab
path: app/build/outputs/bundle/release/*signed.aab

- name: Upload to Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: play-store-key.json
packageName: com.paulcoding.hviewer
releaseFiles: app/build/outputs/bundle/release/*signed.aab
track: ${{ github.event.inputs.track }}
21 changes: 10 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ jobs:
uses: android-actions/setup-android@v3

- name: Build app
run: ./gradlew assembleRelease
run: |
./gradlew assembleRelease

- name: Sign APK
id: sign_app
Expand All @@ -50,21 +51,19 @@ jobs:
mv app/build/outputs/apk/release/app-x86-release-unsigned-signed.apk hviewer-${{ github.ref_name }}-x86-release.apk
mv app/build/outputs/apk/release/app-x86_64-release-unsigned-signed.apk hviewer-${{ github.ref_name }}-x86_64-release.apk

# - name: Create changelog
# id: changelog
# uses: requarks/changelog-action@v1
# with:
# token: ${{ github.token }}
# tag: ${{ github.ref_name }}
# includeInvalidCommits: true
# excludeTypes: build,chore
# writeToFile: false
- name: Create changelog
id: changelog
uses: requarks/changelog-action@v1
with:
includeInvalidCommits: true
token: ${{ github.token }}
tag: ${{ github.ref_name }}

- name: Create release
uses: softprops/action-gh-release@v2
with:
draft: true
body: ChangeLog
body: ${{ steps.changelog.outputs.changes }}
files: |
hviewer-${{ github.ref_name }}-arm64-v8a-release.apk
hviewer-${{ github.ref_name }}-armeabi-v7a-release.apk
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ local.properties
/keystore.properties
.kotlin
/app/release
/key.properties
32 changes: 29 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.util.prefixIfNot
import java.util.Properties

plugins {
alias(libs.plugins.android.application)
Expand All @@ -10,6 +11,23 @@ plugins {
id("kotlin-parcelize")
}

val keystorePropertiesFile = rootProject.file("key.properties")
val keystoreProperties = Properties()
if (keystorePropertiesFile.exists()) {
keystorePropertiesFile.inputStream().use {
keystoreProperties.load(it)
}
}

val versionPropsFile = rootProject.file("version.properties")
val versionProps = Properties()

if (versionPropsFile.exists()) {
versionPropsFile.inputStream().use {
versionProps.load(it)
}
}

android {
signingConfigs {
getByName("debug") {
Expand All @@ -18,6 +36,13 @@ android {
storePassword = "android"
keyPassword = "android"
}

create("release") {
storeFile = file("release.keystore")
keyAlias = keystoreProperties["keyAlias"]?.toString() ?: ""
storePassword = keystoreProperties["storePassword"]?.toString() ?: ""
keyPassword = keystoreProperties["keyPassword"]?.toString() ?: ""
}
}
namespace = "com.paulcoding.hviewer"
compileSdk = 36
Expand All @@ -32,9 +57,9 @@ android {
defaultConfig {
applicationId = "com.paulcoding.hviewer"
minSdk = 26
targetSdk = 34
versionCode = 1
versionName = "1.6.1"
targetSdk = 35
versionCode = versionProps["VERSION_CODE"]?.toString()?.toInt() ?: 1
versionName = versionProps["VERSION_NAME"]?.toString() ?: "1.0.0"

buildConfigField("String", "REPO_URL", "\"$repoUrl\"")

Expand All @@ -57,6 +82,7 @@ android {
signingConfig = signingConfigs.getByName("debug")
}
release {
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
Expand Down
Binary file added app/release.keystore
Binary file not shown.
2 changes: 2 additions & 0 deletions version.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VERSION_CODE=3
VERSION_NAME=1.6.1