build(ci): restrict JitPack repository to GitHub packages only
Some checks failed
Frontend CI / ota (ios) (push) Has been cancelled
Frontend CI / build-and-push-web (push) Has been cancelled
Frontend CI / ota (android) (push) Has been cancelled
Frontend CI / build-android-apk (push) Failing after 18m17s

Add group filtering to JitPack Maven repository configuration to limit
dependency resolution to com.github.* groups, improving build security
and reducing potential resolution of unintended packages.
This commit is contained in:
lafay
2026-06-16 00:41:13 +08:00
parent b0b868593d
commit a31225dce2

View File

@@ -159,32 +159,17 @@ jobs:
- name: Generate Android native project - name: Generate Android native project
run: npx expo prebuild --platform android run: npx expo prebuild --platform android
- name: Configure Gradle with China mirrors and signing - name: Configure Gradle with signing
run: | run: |
cd android cd android
# Switch Gradle distribution to Tencent mirror
PROPS="gradle/wrapper/gradle-wrapper.properties"
if [ -f "$PROPS" ]; then
sed -i 's|distributionUrl=https\\://services.gradle.org/distributions/|distributionUrl=https\\://mirrors.cloud.tencent.com/gradle/|' "$PROPS"
echo "Updated gradle-wrapper.properties:"
cat "$PROPS"
else
echo "gradle-wrapper.properties not found"
exit 1
fi
# Decode Android signing keystore # Decode Android signing keystore
echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > app/withyou-release-key.keystore echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 -d > app/withyou-release-key.keystore
# Update settings.gradle with China Maven mirrors # Update settings.gradle
cat > settings.gradle << 'SETTINGS_EOF' cat > settings.gradle << 'SETTINGS_EOF'
pluginManagement { pluginManagement {
repositories { repositories {
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://developer.huawei.com/repo/' } maven { url 'https://developer.huawei.com/repo/' }
google() google()
mavenCentral() mavenCentral()
@@ -216,9 +201,6 @@ jobs:
dependencyResolutionManagement { dependencyResolutionManagement {
repositories { repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://developer.huawei.com/repo/' } maven { url 'https://developer.huawei.com/repo/' }
google() google()
mavenCentral() mavenCentral()
@@ -248,16 +230,12 @@ jobs:
includeBuild(expoAutolinking.reactNativeGradlePlugin) includeBuild(expoAutolinking.reactNativeGradlePlugin)
SETTINGS_EOF SETTINGS_EOF
# Update build.gradle with China Maven mirrors # Update build.gradle
cat > build.gradle << 'BUILD_EOF' cat > build.gradle << 'BUILD_EOF'
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
repositories { repositories {
maven { url 'https://maven.aliyun.com/repository/gradle-plugin' }
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://developer.huawei.com/repo/' } maven { url 'https://developer.huawei.com/repo/' }
google() google()
mavenCentral() mavenCentral()
@@ -275,9 +253,6 @@ jobs:
allprojects { allprojects {
repositories { repositories {
maven { url 'https://maven.aliyun.com/repository/google' }
maven { url 'https://maven.aliyun.com/repository/public' }
maven { url 'https://maven.aliyun.com/repository/central' }
maven { url 'https://developer.huawei.com/repo/' } maven { url 'https://developer.huawei.com/repo/' }
google() google()
mavenCentral() mavenCentral()