Redirect script informational/warning output to stderr and improve robustness of release tooling. Changes include: - Redirect many echo messages to stderr so scripts can emit machine-readable output on stdout. - Extract-release-notes: better parsing of CHANGELOG entries (tries v-prefixed and non-prefixed headings, cleaner note formatting) and improved fallbacks when changelog is missing. - Extract-version: accept versions with +build or -suffix, add diagnostic output when pubspec is missing, and tighten validation. - Setup/verify APK signing: more consistent stderr logging and clearer warnings; ensure keystore decoding/logging is visible. - Minor script usage message fixes (generate-tag-name, attach-apk-to-release). - CI/workflows: change backend-foundation, mobile-ci, and web-quality triggers to workflow_dispatch (manual runs); update product-release (make scripts step label emoji, remove node cache lines, bump Flutter to 3.38.x). These changes improve CI reliability, make scripts friendlier for automated consumers, and fix release note/version parsing edge cases.
61 lines
1.9 KiB
Bash
Executable File
61 lines
1.9 KiB
Bash
Executable File
#!/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" >&2
|
|
echo "Usage: $0 <tag_name> <app> <app_name> <version> <environment>" >&2
|
|
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" >&2
|
|
echo "Searching for APK files..." >&2
|
|
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..." >&2
|
|
gh release upload "$TAG_NAME" "/tmp/$APK_NAME" --clobber
|
|
|
|
echo "✅ APK attached to release: $APK_NAME" >&2
|