Skip to content

ci: add GitHub Actions workflow for Android build #1

ci: add GitHub Actions workflow for Android build

ci: add GitHub Actions workflow for Android build #1

Workflow file for this run

name: Android CI & Release Build

Check failure on line 1 in .github/workflows/android.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/android.yml

Invalid workflow file

(Line: 53, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.KEYSTORE_BASE64 != '', (Line: 58, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.KEYSTORE_BASE64 != '', (Line: 79, Col: 13): Unrecognized named-value: 'secrets'. Located at position 1 within expression: secrets.KEYSTORE_BASE64 != ''
on:
push:
branches: [ "main", "master" ]
pull_request:
branches: [ "main", "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Create .env from GitHub Secrets
run: |
echo "GEMINI_API_KEY=${{ secrets.GEMINI_API_KEY }}" >> .env
- name: Grant Execute Permission for Gradle Wrapper
run: |
if [ -f "./gradlew" ]; then
chmod +x gradlew
fi
- name: Build Debug APK
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: |
if [ -f "./gradlew" ]; then
./gradlew assembleDebug --no-daemon
else
gradle assembleDebug --no-daemon
fi
- name: Run Unit Tests
run: |
if [ -f "./gradlew" ]; then
./gradlew testDebugUnitTest --no-daemon
else
gradle testDebugUnitTest --no-daemon
fi
- name: Decode Keystore (Optional for Release)
if: ${{ secrets.KEYSTORE_BASE64 != '' }}
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > release.keystore
- name: Build Release APK
if: ${{ secrets.KEYSTORE_BASE64 != '' }}
env:
KEYSTORE_PATH: ${{ github.workspace }}/release.keystore
STORE_PASSWORD: ${{ secrets.STORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: |
if [ -f "./gradlew" ]; then
./gradlew assembleRelease --no-daemon
else
gradle assembleRelease --no-daemon
fi
- name: Upload Debug APK Artifact
uses: actions/upload-artifact@v4
with:
name: app-debug-apk
path: app/build/outputs/apk/debug/app-debug.apk
- name: Upload Release APK Artifact
if: ${{ secrets.KEYSTORE_BASE64 != '' }}
uses: actions/upload-artifact@v4
with:
name: app-release-apk
path: app/build/outputs/apk/release/app-release.apk