-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-release.sh
More file actions
executable file
·161 lines (132 loc) · 4.31 KB
/
Copy pathbuild-release.sh
File metadata and controls
executable file
·161 lines (132 loc) · 4.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/bin/bash
# StreamBerry-Cam Release Build Script
# This script builds a signed release APK and App Bundle
set -e # Exit on error
echo "🍓 StreamBerry-Cam Release Build Script"
echo "========================================"
echo ""
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Check if key.properties exists
if [ ! -f "android/key.properties" ]; then
echo -e "${RED}❌ Error: android/key.properties not found!${NC}"
echo ""
echo "Please create android/key.properties with your signing configuration."
echo "You can copy android/key.properties.example as a template."
echo ""
echo "To generate a signing key, run:"
echo " keytool -genkey -v -keystore ~/streamberry-release-key.jks \\"
echo " -keyalg RSA -keysize 2048 -validity 10000 \\"
echo " -alias streamberry"
echo ""
exit 1
fi
echo "✅ Signing configuration found"
echo ""
# Clean previous builds
echo "🧹 Cleaning previous builds..."
flutter clean
rm -rf build/
echo "✅ Clean complete"
echo ""
# Get dependencies
echo "📦 Getting Flutter dependencies..."
flutter pub get
echo "✅ Dependencies installed"
echo ""
# Analyze code
echo "🔍 Analyzing code..."
flutter analyze --no-fatal-infos
echo "✅ Code analysis complete"
echo ""
# Run tests
echo "🧪 Running tests..."
flutter test
echo "✅ Tests passed"
echo ""
# Build release APK
echo "🔨 Building release APK..."
flutter build apk --release --split-per-abi
if [ $? -eq 0 ]; then
echo -e "${GREEN}✅ APK build successful!${NC}"
echo ""
echo "📦 APK files created:"
ls -lh build/app/outputs/flutter-apk/*.apk
echo ""
else
echo -e "${RED}❌ APK build failed!${NC}"
exit 1
fi
# Build app bundle
echo "🔨 Building app bundle..."
flutter build appbundle --release
if [ $? -eq 0 ]; then
echo -e "${GREEN}✅ App bundle build successful!${NC}"
echo ""
echo "📦 App bundle created:"
ls -lh build/app/outputs/bundle/release/*.aab
echo ""
else
echo -e "${RED}❌ App bundle build failed!${NC}"
exit 1
fi
# Create release directory
RELEASE_DIR="releases/v1.0.0"
mkdir -p "$RELEASE_DIR"
# Copy artifacts
echo "📋 Copying release artifacts..."
cp build/app/outputs/flutter-apk/app-arm64-v8a-release.apk "$RELEASE_DIR/streamberry-v1.0.0-arm64.apk"
cp build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk "$RELEASE_DIR/streamberry-v1.0.0-arm32.apk"
cp build/app/outputs/flutter-apk/app-x86_64-release.apk "$RELEASE_DIR/streamberry-v1.0.0-x86_64.apk"
cp build/app/outputs/bundle/release/app-release.aab "$RELEASE_DIR/streamberry-v1.0.0.aab"
# Create universal APK (optional, for easier distribution)
echo "🔨 Creating universal APK..."
flutter build apk --release
if [ $? -eq 0 ]; then
cp build/app/outputs/flutter-apk/app-release.apk "$RELEASE_DIR/streamberry-v1.0.0-universal.apk"
echo -e "${GREEN}✅ Universal APK created${NC}"
fi
echo ""
echo "✅ Release artifacts copied to $RELEASE_DIR"
echo ""
# Verify signing
echo "🔐 Verifying APK signature..."
jarsigner -verify -verbose -certs "$RELEASE_DIR/streamberry-v1.0.0-universal.apk" | grep "Signed by"
if [ $? -eq 0 ]; then
echo -e "${GREEN}✅ APK is properly signed${NC}"
else
echo -e "${YELLOW}⚠️ Could not verify signature${NC}"
fi
echo ""
# Calculate checksums
echo "🔢 Calculating checksums..."
cd "$RELEASE_DIR"
sha256sum *.apk *.aab > checksums.txt
cd - > /dev/null
echo "✅ Checksums saved to $RELEASE_DIR/checksums.txt"
echo ""
# Display summary
echo "========================================"
echo -e "${GREEN}🎉 Build Complete!${NC}"
echo "========================================"
echo ""
echo "Release artifacts:"
echo " 📱 Universal APK: $RELEASE_DIR/streamberry-v1.0.0-universal.apk"
echo " 📱 ARM64 APK: $RELEASE_DIR/streamberry-v1.0.0-arm64.apk"
echo " 📱 ARM32 APK: $RELEASE_DIR/streamberry-v1.0.0-arm32.apk"
echo " 📱 x86_64 APK: $RELEASE_DIR/streamberry-v1.0.0-x86_64.apk"
echo " 📦 App Bundle: $RELEASE_DIR/streamberry-v1.0.0.aab"
echo " 🔢 Checksums: $RELEASE_DIR/checksums.txt"
echo ""
echo "Next steps:"
echo " 1. Test the APK on real devices"
echo " 2. Create a GitHub release"
echo " 3. Upload artifacts to GitHub"
echo " 4. Update release notes"
echo ""
echo "To install on device:"
echo " adb install $RELEASE_DIR/streamberry-v1.0.0-universal.apk"
echo ""