Set TWA default host to peds.danvics.com, simplify APK workflow
This commit is contained in:
parent
3b7994c2c1
commit
b498c18fce
2 changed files with 25 additions and 67 deletions
82
.github/workflows/build-apk.yml
vendored
82
.github/workflows/build-apk.yml
vendored
|
|
@ -6,11 +6,11 @@ on:
|
|||
workflow_dispatch:
|
||||
inputs:
|
||||
app_url:
|
||||
description: 'App URL for TWA (e.g. https://scribe.example.com)'
|
||||
required: true
|
||||
description: 'App URL override (default: https://peds.danvics.com)'
|
||||
required: false
|
||||
|
||||
env:
|
||||
APP_URL: ${{ github.event.inputs.app_url || secrets.APP_URL }}
|
||||
APP_URL: ${{ github.event.inputs.app_url || secrets.APP_URL || 'https://peds.danvics.com' }}
|
||||
|
||||
jobs:
|
||||
build-apk:
|
||||
|
|
@ -28,57 +28,19 @@ jobs:
|
|||
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/') != ''
|
||||
- name: Build APK
|
||||
working-directory: android
|
||||
run: |
|
||||
# Extract host from APP_URL for Gradle property
|
||||
TWA_HOST=$(echo "${{ env.APP_URL }}" | sed 's|https://||;s|http://||;s|/.*||')
|
||||
chmod +x gradlew 2>/dev/null || true
|
||||
./gradlew assembleRelease 2>/dev/null || echo "Gradle build skipped - TWA project needs initial setup"
|
||||
./gradlew assembleRelease -PTWA_HOST="${TWA_HOST}" || echo "::warning::Gradle build failed — ensure Android SDK and gradle wrapper are set up"
|
||||
|
||||
- name: Sign APK
|
||||
if: hashFiles('android/app/build/outputs/apk/release/*.apk') != ''
|
||||
if: success()
|
||||
uses: r0adkll/sign-android-release@v1
|
||||
id: sign
|
||||
with:
|
||||
|
|
@ -87,36 +49,30 @@ jobs:
|
|||
alias: ${{ secrets.ANDROID_KEY_ALIAS }}
|
||||
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
||||
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
||||
continue-on-error: true
|
||||
|
||||
- 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
|
||||
files: android/app/build/outputs/apk/release/*.apk
|
||||
generate_release_notes: true
|
||||
|
||||
- name: Upload artifact
|
||||
if: success()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: twa-config
|
||||
path: android-twa/twa-manifest.json
|
||||
name: pediatric-scribe-apk
|
||||
path: android/app/build/outputs/apk/release/*.apk
|
||||
retention-days: 30
|
||||
if-no-files-found: warn
|
||||
|
||||
- name: Summary
|
||||
run: |
|
||||
echo "### TWA APK Build" >> $GITHUB_STEP_SUMMARY
|
||||
echo "TWA manifest generated for: ${{ env.APP_URL }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Built 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
|
||||
echo "**Obtainium setup:**" >> $GITHUB_STEP_SUMMARY
|
||||
echo "1. Add repo URL: \`https://github.com/ifedan-ed/pediatric-ai-scribe-v3\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "2. Source: GitHub Releases" >> $GITHUB_STEP_SUMMARY
|
||||
echo "3. APK auto-updates on new \`v*\` tags" >> $GITHUB_STEP_SUMMARY
|
||||
|
|
|
|||
|
|
@ -13,12 +13,14 @@ android {
|
|||
versionCode 1
|
||||
versionName "1.0.0"
|
||||
|
||||
// TWA host URL — change to your deployed app URL
|
||||
// TWA host URL — default: peds.danvics.com (change if self-hosting elsewhere)
|
||||
def twaHost = project.hasProperty('TWA_HOST') ? project.property('TWA_HOST') : "peds.danvics.com"
|
||||
def twaUrl = "https://${twaHost}"
|
||||
manifestPlaceholders = [
|
||||
hostName: "scribe.example.com",
|
||||
defaultUrl: "https://scribe.example.com",
|
||||
hostName: twaHost,
|
||||
defaultUrl: twaUrl,
|
||||
launcherName: "PedScribe",
|
||||
assetStatements: '[{ "relation": ["delegate_permission/common.handle_all_urls"], "target": { "namespace": "web", "site": "https://scribe.example.com" } }]'
|
||||
assetStatements: "[{ \"relation\": [\"delegate_permission/common.handle_all_urls\"], \"target\": { \"namespace\": \"web\", \"site\": \"${twaUrl}\" } }]"
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue