fix(ci): 修复 YAML 格式问题,使用 heredoc 正确配置 Maven 镜像
Some checks failed
Frontend CI / ota-android (push) Successful in 12m14s
Frontend CI / build-android-apk (push) Failing after 7m26s
Frontend CI / build-and-push-web (push) Failing after 1m39s

This commit is contained in:
2026-03-17 23:48:57 +08:00
parent 6ba24c59aa
commit 8a95dbcb59

View File

@@ -128,7 +128,7 @@ jobs:
- name: Configure Gradle
run: |
cd android
cat > gradle.properties << EOF
cat > gradle.properties << 'GRADLE_PROPS'
org.gradle.daemon=false
org.gradle.parallel=false
org.gradle.configureondemand=false
@@ -138,48 +138,43 @@ jobs:
android.useAndroidX=true
hermesEnabled=true
reactNativeArchitectures=arm64-v8a
EOF
GRADLE_PROPS
# Add Aliyun Maven mirror to settings.gradle
sed -i '1a\
pluginManagement {\
repositories {\
google()\
mavenCentral()\
gradlePluginPortal()\
maven { url "https://maven.aliyun.com/repository/public" }\
maven { url "https://maven.aliyun.com/repository/google" }\
maven { url "https://maven.aliyun.com/repository/central" }\
maven { url "https://maven.aliyun.com/repository/gradle-plugin" }\
}\
}\
\
dependencyResolutionManagement {\
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)\
repositories {\
google()\
mavenCentral()\
maven { url "https://maven.aliyun.com/repository/public" }\
maven { url "https://maven.aliyun.com/repository/google" }\
maven { url "https://maven.aliyun.com/repository/central" }\
}\
}\
' settings.gradle
# Create new settings.gradle with Aliyun Maven mirror
cat > settings.gradle.new << 'SETTINGS_EOF'
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
}
}
# Add Aliyun Maven mirror to build.gradle
sed -i '/repositories {/a\
maven { url "https://maven.aliyun.com/repository/public" }\
maven { url "https://maven.aliyun.com/repository/google" }\
maven { url "https://maven.aliyun.com/repository/central" }\
' build.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/central' }
}
}
SETTINGS_EOF
# Append original content (skip first pluginManagement block if exists)
tail -n +2 settings.gradle >> settings.gradle.new || true
mv settings.gradle.new settings.gradle
# Add Aliyun Maven mirror to build.gradle repositories
sed -i '/repositories {/a\ maven { url "https://maven.aliyun.com/repository/public" }\n maven { url "https://maven.aliyun.com/repository/google" }\n maven { url "https://maven.aliyun.com/repository/central" }' build.gradle || true
# Fix hermesEnabled in build.gradle
sed -i 's/def hermesEnabled = findProperty("hermesEnabled")/def hermesEnabled = findProperty("hermesEnabled") ?: "true"/' app/build.gradle || true
grep -n "hermesEnabled" app/build.gradle || echo "hermesEnabled not found in build.gradle"
# Fix hermesEnabled in build.gradle
sed -i 's/def hermesEnabled = findProperty("hermesEnabled")/def hermesEnabled = findProperty("hermesEnabled") ?: "true"/' app/build.gradle || true
grep -n "hermesEnabled" app/build.gradle || echo "hermesEnabled not found in build.gradle"
- name: Build Android release APK (arm64 only)
run: |