✨ 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)
66 lines
1.7 KiB
Bash
Executable File
66 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
# Extract release notes from CHANGELOG for a specific version
|
|
# Usage: ./extract-release-notes.sh <app> <version> <environment> <tag_name> <output_file>
|
|
|
|
set -e
|
|
|
|
APP=$1
|
|
VERSION=$2
|
|
ENV=$3
|
|
TAG_NAME=$4
|
|
OUTPUT_FILE=$5
|
|
|
|
if [ -z "$APP" ] || [ -z "$VERSION" ] || [ -z "$ENV" ] || [ -z "$TAG_NAME" ] || [ -z "$OUTPUT_FILE" ]; then
|
|
echo "❌ Error: Missing required parameters"
|
|
echo "Usage: ./extract-release-notes.sh <app> <version> <environment> <tag_name> <output_file>"
|
|
exit 1
|
|
fi
|
|
|
|
# Determine CHANGELOG path and app name
|
|
if [ "$APP" = "worker" ]; then
|
|
CHANGELOG_PATH="apps/mobile/apps/staff/CHANGELOG.md"
|
|
APP_NAME="Staff Mobile App (Worker)"
|
|
else
|
|
CHANGELOG_PATH="apps/mobile/apps/client/CHANGELOG.md"
|
|
APP_NAME="Client Mobile App"
|
|
fi
|
|
|
|
# Try to extract release notes for this version
|
|
if [ -f "$CHANGELOG_PATH" ]; then
|
|
echo "📝 Found CHANGELOG at $CHANGELOG_PATH"
|
|
|
|
# Extract section for this version
|
|
# Look for ## [VERSION] and collect until next ## [ or end of file
|
|
NOTES=$(awk "/## \[${VERSION}\]/,/^## \[/" "$CHANGELOG_PATH" | sed '1d;$d' | sed '/^$/d')
|
|
|
|
if [ -z "$NOTES" ]; then
|
|
echo "⚠️ Warning: No CHANGELOG entry found for version $VERSION"
|
|
NOTES="Release $VERSION for $APP_NAME
|
|
|
|
⚠️ No CHANGELOG entry found for this version. Please update the CHANGELOG manually.
|
|
|
|
**Environment:** $ENV
|
|
**Tag:** $TAG_NAME"
|
|
else
|
|
echo "✅ Extracted release notes for version $VERSION"
|
|
NOTES="# $APP_NAME - Release $VERSION
|
|
|
|
$NOTES
|
|
|
|
---
|
|
|
|
**Environment:** $ENV
|
|
**Tag:** $TAG_NAME"
|
|
fi
|
|
else
|
|
echo "⚠️ Warning: CHANGELOG not found at $CHANGELOG_PATH"
|
|
NOTES="Release $VERSION for $APP_NAME
|
|
|
|
**Environment:** $ENV
|
|
**Tag:** $TAG_NAME"
|
|
fi
|
|
|
|
# Save to output file
|
|
echo "$NOTES" > "$OUTPUT_FILE"
|
|
echo "✅ Release notes saved to $OUTPUT_FILE"
|