You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

98 lines
2.5 KiB

#!/bin/bash
echo "🚀 Starting HikeMap APK Build Process..."
# Configuration
APP_NAME="HikeMap"
PACKAGE_ID="org.duckdns.bibbit.hikemap"
HOST="maps.bibbit.duckdns.org"
KEYSTORE_PASSWORD="hikemap2024"
cd /app
# Check if project files exist
if [ ! -f "twa-manifest.json" ]; then
echo "📝 Creating TWA manifest..."
cat > twa-manifest.json <<EOF
{
"packageId": "${PACKAGE_ID}",
"host": "${HOST}",
"name": "HikeMap Trail Navigator",
"launcherName": "HikeMap",
"display": "standalone",
"themeColor": "#4CAF50",
"navigationColor": "#4CAF50",
"backgroundColor": "#ffffff",
"enableNotifications": true,
"startUrl": "/",
"iconUrl": "https://${HOST}/icon-512x512.png",
"maskableIconUrl": "https://${HOST}/icon-512x512.png",
"splashScreenFadeOutDuration": 300,
"signingKey": {
"alias": "android",
"path": "/app/android.keystore",
"password": "${KEYSTORE_PASSWORD}",
"keyPassword": "${KEYSTORE_PASSWORD}"
},
"appVersionName": "1.0.0",
"appVersionCode": 1,
"generatorApp": "bubblewrap-cli",
"webManifestUrl": "https://${HOST}/manifest.json",
"fallbackType": "customtabs",
"features": {
"locationDelegation": {
"enabled": true
}
},
"orientation": "portrait",
"fingerprints": []
}
EOF
fi
# Generate keystore if it doesn't exist
if [ ! -f "android.keystore" ]; then
echo "🔐 Generating signing keystore..."
keytool -genkey -v \
-keystore android.keystore \
-alias android \
-keyalg RSA \
-keysize 2048 \
-validity 10000 \
-storepass ${KEYSTORE_PASSWORD} \
-keypass ${KEYSTORE_PASSWORD} \
-dname "CN=HikeMap, OU=Apps, O=Bibbit, L=Austin, ST=Texas, C=US"
echo "✅ Keystore created"
fi
# Initialize Bubblewrap project
echo "🎁 Initializing Bubblewrap project..."
bubblewrap init --manifest=twa-manifest.json <<EOF
y
EOF
# Build the APK
echo "🔨 Building APK..."
bubblewrap build
# Find the generated APK
APK_PATH=$(find . -name "*.apk" -type f | head -1)
if [ -f "$APK_PATH" ]; then
# Copy APK to output directory
cp "$APK_PATH" /app/output/hikemap.apk
echo "✅ APK built successfully!"
echo "📦 Output: /app/output/hikemap.apk"
echo ""
echo "📱 APK Details:"
echo " Name: HikeMap Trail Navigator"
echo " Package: ${PACKAGE_ID}"
echo " Version: 1.0.0"
echo " Size: $(du -h /app/output/hikemap.apk | cut -f1)"
echo ""
echo "🎉 Ready to install on Android devices!"
else
echo "❌ Build failed - APK not found"
exit 1
fi