TF-4268 Automate Sentry symbol upload for Android release builds (#4442)

This commit is contained in:
Dat Vu
2026-04-14 12:32:03 +07:00
committed by GitHub
parent 16376fccb4
commit 1d594804b5
4 changed files with 99 additions and 1 deletions
+50
View File
@@ -89,3 +89,53 @@ jobs:
APPLE_KEY_CONTENT: ${{ secrets.APPLE_KEY_CONTENT }}
run: ../scripts/build-release.sh
working-directory: ${{ matrix.os }}
# --- UPLOAD SENTRY MAPPING AND SYMBOLS FOR ANDROID ---
- name: Upload Android ProGuard Mapping & Dart Debug Symbols to Sentry
if: matrix.os == 'android'
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
run: |
# 1. Install Sentry CLI
curl -sL https://sentry.io/get-cli/ | SENTRY_CLI_VERSION="2.42.2" bash
# 2. Validate tag version matches pubspec.yaml version
TAG_VERSION="${GITHUB_REF_NAME#v}"
TAG_VERSION="${TAG_VERSION%%-rc*}"
PUBSPEC_VERSION=$(awk '/^version:/{split($2,a,"+"); print a[1]; exit}' pubspec.yaml)
if [ "$PUBSPEC_VERSION" != "$TAG_VERSION" ]; then
echo "::error::Tag version ($TAG_VERSION) does not match pubspec version ($PUBSPEC_VERSION)."
exit 1
fi
SENTRY_RELEASE="$PUBSPEC_VERSION"
echo "Processing Sentry Release: $SENTRY_RELEASE"
# 3. Create Release
sentry-cli releases new "$SENTRY_RELEASE"
# 4. Upload ProGuard Mapping
MAPPING_FILE="build/app/outputs/mapping/release/mapping.txt"
if [ -f "$MAPPING_FILE" ]; then
echo "Found mapping.txt, uploading ProGuard mapping..."
sentry-cli upload-proguard "$MAPPING_FILE"
else
echo "::error::Could not find mapping.txt at $MAPPING_FILE."
exit 1
fi
# 5. Upload Dart Debug Symbols (Native Dart Stacktrace)
SYMBOLS_DIR="build/app/outputs/symbols"
if [ -d "$SYMBOLS_DIR" ]; then
echo "Uploading Dart debug symbols from $SYMBOLS_DIR..."
sentry-cli debug-files upload "$SYMBOLS_DIR"
else
echo "::error::Symbols directory not found at $SYMBOLS_DIR. Check your Fastfile build arguments."
exit 1
fi
# 6. Finalize
sentry-cli releases finalize "$SENTRY_RELEASE"