Add mobile APK signing, build and release scripts

Add four new helper scripts for mobile APK workflows: setup-apk-signing.sh (decode keystores and export signing env vars), verify-apk-signature.sh (check and display APK certificate info), attach-apk-to-release.sh (rename and upload APK to a GitHub Release), and setup-mobile-github-secrets.sh (helper to generate/show required GitHub Secrets). Update product-release.yml to expose version/tag outputs and add a build-mobile-artifacts job that sets up Java/Flutter, installs deps, configures signing from repository secrets, builds APKs for worker/client apps, verifies signatures, uploads artifacts, and optionally attaches the APK to the GitHub Release. Secrets and envvar naming conventions are handled to support dev/staging/prod keystores; documentation references (docs/RELEASE/APK_SIGNING_SETUP.md) are noted in scripts.
This commit is contained in:
Achintha Isuru
2026-03-05 14:03:21 -05:00
parent 4cc2dafa18
commit bdacedbced
5 changed files with 629 additions and 0 deletions

60
.github/scripts/attach-apk-to-release.sh vendored Executable file
View File

@@ -0,0 +1,60 @@
#!/bin/bash
# =============================================================================
# Attach APK to GitHub Release
# =============================================================================
# This script attaches a built APK to a GitHub Release with proper naming
#
# Usage:
# ./attach-apk-to-release.sh <tag_name> <app> <app_name> <version> <environment>
#
# Arguments:
# tag_name - Git tag name (e.g., krow-withus-worker-mobile/dev-v0.1.0)
# app - worker-mobile-app or client-mobile-app
# app_name - staff or client (internal build folder name)
# version - Version number (e.g., 0.1.0)
# environment - dev, stage, or prod
#
# Environment Variables:
# GH_TOKEN - GitHub token for gh CLI authentication
# =============================================================================
set -e
TAG_NAME="$1"
APP="$2"
APP_NAME="$3"
VERSION="$4"
ENV="$5"
if [ -z "$TAG_NAME" ] || [ -z "$APP" ] || [ -z "$APP_NAME" ] || [ -z "$VERSION" ] || [ -z "$ENV" ]; then
echo "❌ Error: Missing required arguments"
echo "Usage: $0 <tag_name> <app> <app_name> <version> <environment>"
exit 1
fi
# Find APK in build output
APK_PATH="apps/mobile/apps/${APP_NAME}/build/app/outputs/flutter-apk/app-release.apk"
if [ ! -f "$APK_PATH" ]; then
echo "❌ Error: APK not found at $APK_PATH"
echo "Searching for APK files..."
find apps/mobile/apps/${APP_NAME} -name "*.apk"
exit 1
fi
# Create proper APK name based on app type
if [ "$APP" = "worker-mobile-app" ]; then
APK_NAME="krow-withus-worker-mobile-${ENV}-v${VERSION}.apk"
else
APK_NAME="krow-withus-client-mobile-${ENV}-v${VERSION}.apk"
fi
# Copy APK with proper name
cp "$APK_PATH" "/tmp/$APK_NAME"
# Upload to GitHub Release
echo "📤 Uploading $APK_NAME to release $TAG_NAME..."
gh release upload "$TAG_NAME" "/tmp/$APK_NAME" --clobber
echo "✅ APK attached to release: $APK_NAME"