Skip to content

Commit 39d34c5

Browse files
committed
refactor(release): simplify script using absolute paths, remove cd commands
1 parent dafd2b7 commit 39d34c5

1 file changed

Lines changed: 17 additions & 19 deletions

File tree

scripts/prepare-release.sh

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,15 @@ echo "Preparing release version: $VERSION"
1818
# Store the project root directory reliably
1919
PROJECT_ROOT=$(cd "$(dirname "$0")/.." && pwd)
2020

21+
# Define output paths
22+
APK_DIR="${PROJECT_ROOT}/build/app/outputs/flutter-apk"
23+
AAB_DIR="${PROJECT_ROOT}/build/app/outputs/bundle/release"
24+
APK_FILE="FosterSquirrel-v${VERSION}.apk"
25+
AAB_FILE="FosterSquirrel-v${VERSION}.aab"
26+
2127
# Update pubspec.yaml with new version
2228
echo "Updating pubspec.yaml..."
23-
sed -i "s/^version: .*/version: ${VERSION}/" pubspec.yaml
29+
sed -i "s/^version: .*/version: ${VERSION}/" "${PROJECT_ROOT}/pubspec.yaml"
2430

2531
# Build Android APK
2632
echo "Building release APK..."
@@ -30,24 +36,16 @@ flutter build apk --release
3036
echo "Building release App Bundle..."
3137
flutter build appbundle --release
3238

33-
# Rename APK with version
34-
echo "Renaming APK..."
35-
mv build/app/outputs/flutter-apk/app-release.apk \
36-
build/app/outputs/flutter-apk/FosterSquirrel-v${VERSION}.apk
37-
38-
# Rename AAB with version
39-
echo "Renaming App Bundle..."
40-
mv build/app/outputs/bundle/release/app-release.aab \
41-
build/app/outputs/bundle/release/FosterSquirrel-v${VERSION}.aab
42-
43-
# Generate SHA256 checksum for APK
44-
echo "Generating APK checksum..."
45-
cd "${PROJECT_ROOT}/build/app/outputs/flutter-apk"
46-
sha256sum FosterSquirrel-v${VERSION}.apk > FosterSquirrel-v${VERSION}.apk.sha256
39+
# Rename and generate checksums for APK
40+
echo "Processing APK..."
41+
mv "${APK_DIR}/app-release.apk" "${APK_DIR}/${APK_FILE}"
42+
sha256sum "${APK_DIR}/${APK_FILE}" > "${APK_DIR}/${APK_FILE}.sha256"
4743

48-
# Generate SHA256 checksum for AAB
49-
echo "Generating App Bundle checksum..."
50-
cd "${PROJECT_ROOT}/build/app/outputs/bundle/release"
51-
sha256sum FosterSquirrel-v${VERSION}.aab > FosterSquirrel-v${VERSION}.aab.sha256
44+
# Rename and generate checksums for AAB
45+
echo "Processing App Bundle..."
46+
mv "${AAB_DIR}/app-release.aab" "${AAB_DIR}/${AAB_FILE}"
47+
sha256sum "${AAB_DIR}/${AAB_FILE}" > "${AAB_DIR}/${AAB_FILE}.sha256"
5248

5349
echo "✅ Release preparation complete for version $VERSION"
50+
echo " APK: ${APK_DIR}/${APK_FILE}"
51+
echo " AAB: ${AAB_DIR}/${AAB_FILE}"

0 commit comments

Comments
 (0)