✨ Enhanced mobile-release.yml workflow: - 📱 Added emojis to all steps for better visual feedback - 🔧 Version now automatically extracted from pubspec.yaml - No manual version input required - Reads from apps/mobile/apps/staff/pubspec.yaml for worker - Reads from apps/mobile/apps/client/pubspec.yaml for client - 📝 Removed manual version input field from workflow 🔨 Created reusable shell scripts in .github/scripts/: 1. extract-version.sh - Extract version from pubspec.yaml 2. generate-tag-name.sh - Generate tag names consistently 3. extract-release-notes.sh - Extract CHANGELOG sections 4. create-release-summary.sh - Generate GitHub Step Summary with emojis Benefits: ✅ Simpler workflow - just select app and environment ✅ Single source of truth for versions (pubspec.yaml) ✅ Reusable scripts can be used in other workflows ✅ Better error messages and validation ✅ Enhanced visual feedback with emojis ✅ Cleaner workflow file (moved logic to scripts)
49 lines
1.2 KiB
Bash
Executable File
49 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
# Extract version from pubspec.yaml for mobile apps
|
|
# 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 Mobile App (Worker)"
|
|
else
|
|
PUBSPEC_PATH="apps/mobile/apps/client/pubspec.yaml"
|
|
APP_NAME="Client Mobile App"
|
|
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"
|