Set TWA default host to peds.danvics.com, simplify APK workflow
This commit is contained in:
parent
5f066bb760
commit
933d406d93
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:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
app_url:
|
app_url:
|
||||||
description: 'App URL for TWA (e.g. https://scribe.example.com)'
|
description: 'App URL override (default: https://peds.danvics.com)'
|
||||||
required: true
|
required: false
|
||||||
|
|
||||||
env:
|
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:
|
jobs:
|
||||||
build-apk:
|
build-apk:
|
||||||
|
|
@ -28,57 +28,19 @@ jobs:
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '17'
|
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
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
|
|
||||||
- name: Generate TWA Project
|
- name: Build APK
|
||||||
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
|
working-directory: android
|
||||||
run: |
|
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
|
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
|
- name: Sign APK
|
||||||
if: hashFiles('android/app/build/outputs/apk/release/*.apk') != ''
|
if: success()
|
||||||
uses: r0adkll/sign-android-release@v1
|
uses: r0adkll/sign-android-release@v1
|
||||||
id: sign
|
id: sign
|
||||||
with:
|
with:
|
||||||
|
|
@ -87,36 +49,30 @@ jobs:
|
||||||
alias: ${{ secrets.ANDROID_KEY_ALIAS }}
|
alias: ${{ secrets.ANDROID_KEY_ALIAS }}
|
||||||
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
||||||
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Upload APK to Release
|
- name: Upload APK to Release
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: |
|
files: android/app/build/outputs/apk/release/*.apk
|
||||||
android/app/build/outputs/apk/release/*-signed.apk
|
|
||||||
android-twa/twa-manifest.json
|
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
|
if: success()
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: twa-config
|
name: pediatric-scribe-apk
|
||||||
path: android-twa/twa-manifest.json
|
path: android/app/build/outputs/apk/release/*.apk
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
|
if-no-files-found: warn
|
||||||
|
|
||||||
- name: Summary
|
- name: Summary
|
||||||
run: |
|
run: |
|
||||||
echo "### TWA APK Build" >> $GITHUB_STEP_SUMMARY
|
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 "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**To set up Obtainium:**" >> $GITHUB_STEP_SUMMARY
|
echo "**Obtainium setup:**" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "1. Add this repo URL in Obtainium" >> $GITHUB_STEP_SUMMARY
|
echo "1. Add repo URL: \`https://github.com/ifedan-ed/pediatric-ai-scribe-v3\`" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "2. Set source to 'GitHub Releases'" >> $GITHUB_STEP_SUMMARY
|
echo "2. Source: GitHub Releases" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "3. APK will auto-update on new releases" >> $GITHUB_STEP_SUMMARY
|
echo "3. APK auto-updates on new \`v*\` tags" >> $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
|
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,14 @@ android {
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0.0"
|
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 = [
|
manifestPlaceholders = [
|
||||||
hostName: "scribe.example.com",
|
hostName: twaHost,
|
||||||
defaultUrl: "https://scribe.example.com",
|
defaultUrl: twaUrl,
|
||||||
launcherName: "PedScribe",
|
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