Skip to content
Open
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
102 changes: 102 additions & 0 deletions .github/workflows/build_f90984b8-b8a5-4091-b2f0-aa078a86be2c.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Build APK f90984b8-b8a5-4091-b2f0-aa078a86be2c

on:
push:
tags: [ 'V*' ]
pull_request:
branches: [ main, master ]
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

env:
HAS_KEYSTORE: ${{ secrets.SIGNING_KEYSTORE_BASE64 != '' }}

steps:
- name: Checkout source
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: Extract version info
id: version
run: |
VERSION_CODE=$(grep 'versionCode' app/build.gradle | tr -dc '0-9')
VERSION_NAME=$(grep 'versionName' app/build.gradle | sed 's/.*"\(.*\)".*/\1/')
TAG="${GITHUB_REF_NAME:-dev}"
TAG="${TAG#refs/tags/}"
echo "code=$VERSION_CODE" >> $GITHUB_OUTPUT
echo "name=$VERSION_NAME" >> $GITHUB_OUTPUT
echo "tag=$TAG" >> $GITHUB_OUTPUT

# ── Build Debug ────────────────────────────────────────────────────────
- name: Build Debug APK
run: ./gradlew assembleDebug --no-daemon

# ── Build Release (signed) ─────────────────────────────────────────────
- name: Decode Release Keystore
if: env.HAS_KEYSTORE == 'true'
run: |
mkdir -p app/keystore
echo "${{ secrets.SIGNING_KEYSTORE_BASE64 }}" | base64 -d > app/keystore/release.keystore

- name: Build Release APK (signed)
if: env.HAS_KEYSTORE == 'true'
env:
SIGNING_KEYSTORE_PATH: ${{ github.workspace }}/app/keystore/release.keystore
SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}
SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: ./gradlew assembleRelease --no-daemon

- name: Build Release APK (debug keystore fallback)
if: env.HAS_KEYSTORE != 'true'
run: ./gradlew assembleRelease --no-daemon

# ── Rename & Upload ───────────────────────────────────────────────────
- name: Rename APKs
run: |
TAG="${{ steps.version.outputs.tag }}"
mkdir -p artifacts
cp app/build/outputs/apk/debug/app-debug.apk artifacts/codeboard-${TAG}-debug.apk
cp app/build/outputs/apk/release/app-release.apk artifacts/codeboard-${TAG}-release.apk
cp artifacts/codeboard-${TAG}-release.apk artifacts/codeboard-release.apk

- name: Upload Debug APK
uses: actions/upload-artifact@v4
with:
name: codeboard-debug
path: artifacts/codeboard-*-debug.apk
retention-days: 30

- name: Upload Release APK
uses: actions/upload-artifact@v4
with:
name: codeboard-release
path: artifacts/codeboard-*-release.apk
retention-days: 30

# ── Create Release (only when tag V*) ───────────────────────────────
- name: Create GitHub Release
if: startsWith(github.ref, 'refs/tags/V')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ steps.version.outputs.tag }}"
CHANGELOG=$(git log -1 --pretty=%s)
gh release create "$TAG" \
artifacts/codeboard-${TAG}-release.apk \
artifacts/codeboard-release.apk \
--title "Codeboard $TAG" \
--notes "$CHANGELOG" \
--latest
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,6 @@ lint/generated/
lint/outputs/
lint/tmp/
# lint/reports/

# Archives - do not ignore
!archives/logs/activity.log
58 changes: 56 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,68 @@ android {
applicationId "com.gazlaws.codeboard"
minSdkVersion 23
targetSdk 35
versionCode 23
versionName "6.0.3"
versionCode 48
versionName "6.5.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
signingConfigs {
release {
def keystorePath = System.getenv("SIGNING_KEYSTORE_PATH") ?: ""
def localKeystorePath = ""
def props = new Properties()
def localProps = rootProject.file("local.properties")
if (localProps.exists()) {
props.load(localProps.newDataInputStream())
localKeystorePath = props.getProperty("signing.keystore.path", "")
}
def debugKeystore = rootProject.file("app/keystore/debug.keystore")

if (keystorePath != "") {
// Stage 1: env variable (GitHub Actions / terminal)
storeFile file(keystorePath)
storePassword System.getenv("SIGNING_STORE_PASSWORD") ?: ""
keyAlias System.getenv("SIGNING_KEY_ALIAS") ?: ""
keyPassword System.getenv("SIGNING_KEY_PASSWORD") ?: ""
storeType "PKCS12"
} else if (localKeystorePath != "") {
// Stage 2: local.properties (Android Studio)
storeFile file(localKeystorePath)
storePassword props.getProperty("signing.store.password", "")
keyAlias props.getProperty("signing.key.alias", "")
keyPassword props.getProperty("signing.key.password", "")
storeType "PKCS12"
} else if (debugKeystore.exists()) {
// Stage 3: custom app/keystore/debug.keystore (if present)
storeFile debugKeystore
storePassword "android"
keyAlias "androiddebugkey"
keyPassword "android"
}
// Stage 4: everything empty -> storeFile is not set.
// signingConfig is NOT assigned to buildTypes.release (see below),
// so AGP falls back to its default behavior.
}
}

// Only assign signingConfig if a valid keystore actually exists (Stage 1-3).
// If none exists (Stage 4), signingConfig is NOT set at all —
// AGP automatically uses the system's built-in debug keystore.
def hasSigningConfig = (System.getenv("SIGNING_KEYSTORE_PATH") ?: "") != "" ||
({
def p = new Properties()
def lp = rootProject.file("local.properties")
if (lp.exists()) p.load(lp.newDataInputStream())
return (p.getProperty("signing.keystore.path", "") != "")
})() ||
rootProject.file("app/keystore/debug.keystore").exists()

buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (hasSigningConfig) {
signingConfig signingConfigs.release
}
}
}
testOptions {
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>

<application
android:allowBackup="true"
Expand Down Expand Up @@ -41,6 +42,14 @@
android:label="@string/app_intro" />


<receiver
android:name=".clipboard.ClipboardBootReceiver"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED"/>
</intent-filter>
</receiver>

<uses-library android:name="android.test.runner"
android:required="false" />

Expand Down
Loading