pediatric-ai-scribe-v3/.github/workflows/build-apk.yml
Daniel Onyejesi 5f066bb760 v9: Major feature update — audio backup, SOAP save, Dragon memory, S3 docs, CI/CD, APK
Phase 1 — Critical Fixes:
- Fix SOAP instructions not clearing on Clear button
- Show transcription provider (AWS/OpenAI) in UI toast
- Fix silent transcription failures in dictation and SOAP modules
- Add IndexedDB audio backup system (24hr retention, retry from Settings)
- Prevent duplicate encounter saves with idempotency keys
- Add Save/Load/New bar to SOAP note generator

Phase 2 — Features:
- Dragon-like AI memory: auto-track user corrections, inject into prompts
- Per-section template categories (SOAP, HPI, well visit, sick visit)
- Bigger textarea for SOAP instructions
- S3 document upload/management (AWS S3, Backblaze B2, MinIO compatible)
- Faster transcription via lower bitrate recording (16kbps opus)

Phase 3 — APK & CI/CD:
- GitHub Actions: Docker build+push on version tags
- GitHub Actions: TWA APK build for Obtainium auto-updates
- Android TWA project with foreground service for background recording
- Enhanced PWA manifest with shortcuts and maskable icons
2026-03-28 21:08:32 +00:00

122 lines
4.3 KiB
YAML

name: Build TWA APK
on:
push:
tags: ['v*']
workflow_dispatch:
inputs:
app_url:
description: 'App URL for TWA (e.g. https://scribe.example.com)'
required: true
env:
APP_URL: ${{ github.event.inputs.app_url || secrets.APP_URL }}
jobs:
build-apk:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Bubblewrap CLI
run: npm install -g @nickvdyck/pwa-asset-generator @nickvdyck/pwa-asset-generator || npm install -g @nickvdyck/pwa-asset-generator || true
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Generate TWA Project
run: |
mkdir -p android-twa && cd android-twa
# Create bubblewrap manifest
cat > twa-manifest.json << 'MANIFEST'
{
"packageId": "com.pediatricscribe.twa",
"host": "${{ env.APP_URL }}",
"name": "Pediatric AI Scribe",
"launcherName": "PedScribe",
"display": "standalone",
"themeColor": "#2563eb",
"navigationColor": "#1e40af",
"backgroundColor": "#ffffff",
"enableNotifications": true,
"startUrl": "/",
"iconUrl": "${{ env.APP_URL }}/icons/icon-512.png",
"maskableIconUrl": "${{ env.APP_URL }}/icons/icon-512.png",
"shortcuts": [],
"generatorApp": "bubblewrap-cli",
"webManifestUrl": "${{ env.APP_URL }}/manifest.json",
"fallbackType": "customtabs",
"features": {},
"enableSiteSettingsShortcut": true,
"isChromeOSOnly": false,
"isMetaQuest": false,
"fullScopeUrl": "${{ env.APP_URL }}/"
}
MANIFEST
- name: Build with Gradle (if android dir exists)
if: hashFiles('android/') != ''
working-directory: android
run: |
chmod +x gradlew 2>/dev/null || true
./gradlew assembleRelease 2>/dev/null || echo "Gradle build skipped - TWA project needs initial setup"
- name: Sign APK
if: hashFiles('android/app/build/outputs/apk/release/*.apk') != ''
uses: r0adkll/sign-android-release@v1
id: sign
with:
releaseDirectory: android/app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.ANDROID_SIGNING_KEY }}
alias: ${{ secrets.ANDROID_KEY_ALIAS }}
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
- name: Upload APK to Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
files: |
android/app/build/outputs/apk/release/*-signed.apk
android-twa/twa-manifest.json
generate_release_notes: true
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: twa-config
path: android-twa/twa-manifest.json
retention-days: 30
- name: Summary
run: |
echo "### TWA APK Build" >> $GITHUB_STEP_SUMMARY
echo "TWA manifest generated for: ${{ env.APP_URL }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**To set up Obtainium:**" >> $GITHUB_STEP_SUMMARY
echo "1. Add this repo URL in Obtainium" >> $GITHUB_STEP_SUMMARY
echo "2. Set source to 'GitHub Releases'" >> $GITHUB_STEP_SUMMARY
echo "3. APK will auto-update on new releases" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Required secrets:**" >> $GITHUB_STEP_SUMMARY
echo "- APP_URL: Your deployed app URL" >> $GITHUB_STEP_SUMMARY
echo "- ANDROID_SIGNING_KEY: Base64 keystore" >> $GITHUB_STEP_SUMMARY
echo "- ANDROID_KEY_ALIAS: Key alias" >> $GITHUB_STEP_SUMMARY
echo "- ANDROID_KEYSTORE_PASSWORD: Keystore password" >> $GITHUB_STEP_SUMMARY
echo "- ANDROID_KEY_PASSWORD: Key password" >> $GITHUB_STEP_SUMMARY