readest/apps/readest-app/scripts/release-google-play.sh
Huang Xin 00098cad1e
chore(store): rebuild store listings and manage them from fastlane (#5573)
Two spelling mistakes were live on both the App Store and Google Play:
"beatifully organized" and "seemless text-to-speech". The captions were
baked into the screenshot PNGs with no editable source, so fixing them
meant rebuilding the panels.

Screenshots:
* App Store iPhone rebuilt at 1284x2778, the size this record's 6.5 inch
  slot accepts. Panels 3 to 5 recaptured from the simulator.
* iPad captions replaced on the existing 2048x2732 captures.
* macOS set replaced with fresh 2880x1800 captures.
* Google Play phone, 7 inch and 10 inch composites rebuilt from the live
  listing assets rather than the local promo folder, which turned out to
  hold an unused revision of panels 1 and 2.

Captions are now rendered as text by fastlane/compositor/render-caption.mjs
through headless Chromium using the app's own Inter webfont, so the next
typo is a one line fix instead of a repaint.

Metadata:
* fastlane/metadata-play feeds Google Play while fastlane/metadata/android
  stays with F-Droid, so Play can carry a keyword title while F-Droid keeps
  the plain app name.
* fastlane/metadata-macos gives macOS its own App Store text, since
  deliver's metadata_path has no platform dimension and both Apple lanes
  would otherwise push identical copy.
* Descriptions rewritten. Every feature claim was checked against the
  source first, which removed a false "semantic search" claim that was
  live on Play.

Listing text and Play imagery now upload on release. App Store screenshots
stay manual. The internal and beta Play lanes still skip metadata because
Play listing assets are store level, not track level.

Adds pnpm validate-google-play to dry run the Play listing without a build.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-08 07:42:04 +02:00

81 lines
2.8 KiB
Bash
Executable file

#!/bin/bash
set -e
VERSION=$(jq -r '.version' package.json)
MANIFEST="./src-tauri/gen/android/app/src/main/AndroidManifest.xml"
INSTALL_PERMISSION_LINE='<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>'
ised() {
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "$@"
else
sed -i "$@"
fi
return $?
}
# --- REMOVE PERMISSION BEFORE BUILD ---
if grep -q 'REQUEST_INSTALL_PACKAGES' "$MANIFEST"; then
echo "🧹 Removing REQUEST_INSTALL_PACKAGES from AndroidManifest.xml"
if ised "/REQUEST_INSTALL_PACKAGES/d" "$MANIFEST"; then
echo "✅ Successfully removed REQUEST_INSTALL_PACKAGES"
else
echo "❌ Failed to remove REQUEST_INSTALL_PACKAGES" >&2
exit 1
fi
fi
# MANAGE_EXTERNAL_STORAGE stays in the Play build: Readest is a file manager
# style ebook reader and needs All Files Access to keep the library in a
# user-chosen shared folder (issues #5372 and #2862). Play requires a written
# justification in the permission declaration form for every release that
# ships it — see docs/google-play-all-files-access.md for the text to paste.
if ! grep -q 'MANAGE_EXTERNAL_STORAGE' "$MANIFEST"; then
echo "❌ MANAGE_EXTERNAL_STORAGE is missing from AndroidManifest.xml" >&2
exit 1
fi
source .env.google-play.local
echo "🚀 Running: pnpm tauri android build (googleplay flavor)"
ORG_GRADLE_PROJECT_storeFlavor=googleplay pnpm tauri android build --config src-tauri/tauri.playstore.conf.json
# --- ADD PERMISSION BACK AFTER BUILD ---
if ! grep -q 'REQUEST_INSTALL_PACKAGES' "$MANIFEST"; then
echo "♻️ Restoring REQUEST_INSTALL_PACKAGES in AndroidManifest.xml"
ised "/android.permission.INTERNET/a\\
$INSTALL_PERMISSION_LINE
" "$MANIFEST"
fi
echo "📋 Reminder: this build declares MANAGE_EXTERNAL_STORAGE."
echo " Play Console → App content → Permissions → All files access needs the"
echo " justification from docs/google-play-all-files-access.md"
if [[ -z "$GOOGLE_PLAY_JSON_KEY_FILE" ]]; then
echo "❌ GOOGLE_PLAY_JSON_KEY_FILE is not set"
exit 1
fi
# --- GENERATE CHANGELOG FOR GOOGLE PLAY ---
# Play reads from fastlane/metadata-play (see metadata_path in Fastfile);
# fastlane/metadata/android is F-Droid's tree.
CHANGELOG_DIR="../../fastlane/metadata-play/android/en-US/changelogs"
mkdir -p "$CHANGELOG_DIR"
NOTES=$(jq -r --arg ver "$VERSION" '.releases[$ver].notes // empty | map("• " + .) | join("\n")' release-notes.json)
if [[ -n "$NOTES" ]]; then
# Google Play has a 500-character limit for release notes per language
if [[ ${#NOTES} -gt 480 ]]; then
NOTES="${NOTES:0:477}..."
fi
echo "$NOTES" > "$CHANGELOG_DIR/default.txt"
echo "📝 Release notes for v$VERSION written to changelogs/default.txt"
else
echo "⚠️ No release notes found for v$VERSION in release-notes.json"
fi
cd ../../
fastlane android upload_production