Files
Krow-workspace/.github/scripts/extract-version.sh
Achintha Isuru 3e31002d1e refactor(ci): replace mobile-specific terms with generic product terminology
🔄 Updated workflows and scripts to use product-agnostic naming:

Workflow Changes:
- 📱 Mobile Release → 📦 Product Release
- 🚨 Mobile Hotfix → 🚨 Product Hotfix
- Mobile App → Product (in descriptions)
- "mobile app" → "product" (in messages and tags)
- "pubspec.yaml" → "version file" (in user-facing text)

Display Names:
- Worker Mobile → Worker Product
- Client Mobile → Client Product
- Staff Mobile App → Staff Product (Worker)
- Client Mobile App → Client Product

Benefits:
 Makes workflows extensible for other product types
 Consistent terminology across all automation
 Easier to add web, backend, or other products later
 Keeps implementation details (paths, scripts) unchanged
 Maintains backward compatibility with existing tags

Note: File paths remain unchanged (apps/mobile/...) as they are implementation-specific
2026-03-05 11:58:28 -05:00

49 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Extract version from version file for products
# Usage: ./extract-version.sh <app>
# app: worker or client
set -e
APP=$1
if [ -z "$APP" ]; then
echo "❌ Error: App parameter required (worker or client)"
exit 1
fi
# Determine pubspec path
if [ "$APP" = "worker" ]; then
PUBSPEC_PATH="apps/mobile/apps/staff/pubspec.yaml"
APP_NAME="Staff Product (Worker)"
else
PUBSPEC_PATH="apps/mobile/apps/client/pubspec.yaml"
APP_NAME="Client Product"
fi
# Check if pubspec exists
if [ ! -f "$PUBSPEC_PATH" ]; then
echo "❌ Error: pubspec.yaml not found at $PUBSPEC_PATH"
exit 1
fi
# Extract version (format: X.Y.Z+buildNumber)
VERSION_LINE=$(grep "^version:" "$PUBSPEC_PATH")
if [ -z "$VERSION_LINE" ]; then
echo "❌ Error: Could not find version in $PUBSPEC_PATH"
exit 1
fi
# Extract just the semantic version (before the +)
VERSION=$(echo "$VERSION_LINE" | sed 's/version: *//' | sed 's/+.*//' | tr -d ' ')
# Validate version format
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "❌ Error: Invalid version format in pubspec.yaml: $VERSION"
echo "Expected format: X.Y.Z (e.g., 0.1.0)"
exit 1
fi
echo "✅ Extracted version from $PUBSPEC_PATH: $VERSION"
echo "$VERSION"