fix finding apk locations
- Commit
2e2aaf5a79cb6f24a9c7267b736cf57c5929cae1- Author
- Vayun <[email protected]>
- When
- 2026-01-15 21:40 UTC (10 months ago)
- Parents
42a0773
Diff
.github/workflows/android.yml
diff --git a/.github/workflows/android.yml b/.github/workflows/android.ymlindex 4f9be98699..892ab4a1e2 100644--- a/.github/workflows/android.yml+++ b/.github/workflows/android.yml@@ -39,20 +39,22 @@ jobs: - name: Change Gradle Wrapper Permissions run: chmod +x ./gradlew - # 1. CLEAN VERSION BUMP (Handles both Groovy and Kotlin DSL)+ # 1. BUMP VERSION NAME & CODE - name: Bump Version Name and Code run: | NEW_NAME="${{ github.event.inputs.version_name }}" echo "Updating to Version Name: $NEW_NAME" + # Find all build.gradle files find . -name "build.gradle*" | while read file; do # Update versionName sed -i "s/versionName\([[:space:]]*=[[:space:]]*\|[[:space:]]*\)\"[^\"]*\"/versionName\1\"$NEW_NAME\"/g" "$file" - # Increment versionCode+ # Find current versionCode, increment it, and replace it CURRENT_CODE=$(grep -E "versionCode\s*(=?)\s*[0-9]+" "$file" | sed 's/[^0-9]*//g' | head -1) if [ ! -z "$CURRENT_CODE" ]; then NEXT_CODE=$((CURRENT_CODE + 1))+ echo "Bumping $file: Code $CURRENT_CODE -> $NEXT_CODE" sed -i "s/versionCode\([[:space:]]*=[[:space:]]*\|[[:space:]]*\)$CURRENT_CODE/versionCode\1$NEXT_CODE/g" "$file" fi done@@ -66,14 +68,15 @@ jobs: git commit -m "chore: bump version to ${{ github.event.inputs.version_name }}" || echo "No changes to commit" git push - # 3. ROBUST APP MODULE DETECTION (Fixed the syntax error issue)+ # 3. IMPROVED DETECTION: Search for modules with 'versionCode' - name: Detect App Modules run: |- # 1. Grep for the plugin- # 2. Get the directory (module name)- # 3. Filter out the root '.' and clean up characters- MODULES=$(grep -rE "com.android.application" . --include="build.gradle*" | awk -F/ '{print $2}' | grep -v "build.gradle" | sort -u | tr '\n' ' ')- echo "Detected clean modules: $MODULES"+ # Finds directories containing build.gradle files that have a 'versionCode' entry+ # 1. Search for 'versionCode' in build.gradle files+ # 2. Extract the directory name (the module name)+ # 3. Filter out '.' (root) and duplicates+ MODULES=$(grep -rl "versionCode" . --include="build.gradle*" | awk -F/ '{print $(NF-1)}' | grep -vE "^\.$" | sort -u | tr '\n' ' ')+ echo "Detected modules: $MODULES" echo "modules=$MODULES" >> $GITHUB_ENV - name: Download Bundletool@@ -81,12 +84,15 @@ jobs: mkdir -p .github/lib curl -L https://github.com/google/bundletool/releases/download/1.17.2/bundletool-all-1.17.2.jar -o .github/lib/bundletool.jar - # 4. BUILD & SIGN (Using the cleaned module list)+ # 4. BUILD & SIGN - name: Build and Sign run: | mkdir -p distribution_apks for module in ${{ env.modules }}; do- echo "Building module: $module"+ echo "--------------------------------------------"+ echo "Building: $module"+ echo "--------------------------------------------"+ ./gradlew :$module:bundleRelease java -jar ".github/lib/bundletool.jar" build-apks \