mirror of
https://gh-proxy.org/https://github.com/tiajinsha/JKVideo
synced 2026-07-07 23:18:38 +08:00
fix: CI跳过android目录,prebuild后再构建APK
This commit is contained in:
5
.github/workflows/release.yml
vendored
5
.github/workflows/release.yml
vendored
@@ -36,7 +36,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git add app.json package.json android/app/build.gradle
|
git add app.json package.json
|
||||||
git commit -m "chore: bump version to v${{ steps.bump.outputs.version }} [skip ci]"
|
git commit -m "chore: bump version to v${{ steps.bump.outputs.version }} [skip ci]"
|
||||||
git push
|
git push
|
||||||
|
|
||||||
@@ -49,6 +49,9 @@ jobs:
|
|||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
|
|
||||||
|
- name: Expo Prebuild
|
||||||
|
run: npx expo prebuild --platform android --no-install
|
||||||
|
|
||||||
- name: Grant Gradle execute permission
|
- name: Grant Gradle execute permission
|
||||||
run: chmod +x android/gradlew
|
run: chmod +x android/gradlew
|
||||||
|
|
||||||
|
|||||||
@@ -25,11 +25,13 @@ const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
|
|||||||
pkgJson.version = newVersion;
|
pkgJson.version = newVersion;
|
||||||
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2) + '\n');
|
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2) + '\n');
|
||||||
|
|
||||||
// Update android/app/build.gradle
|
// Update android/app/build.gradle if it exists (skipped in CI before prebuild)
|
||||||
const gradlePath = path.join(root, 'android', 'app', 'build.gradle');
|
const gradlePath = path.join(root, 'android', 'app', 'build.gradle');
|
||||||
|
if (fs.existsSync(gradlePath)) {
|
||||||
let gradle = fs.readFileSync(gradlePath, 'utf8');
|
let gradle = fs.readFileSync(gradlePath, 'utf8');
|
||||||
gradle = gradle.replace(/versionCode\s+\d+/, `versionCode ${newVersionCode}`);
|
gradle = gradle.replace(/versionCode\s+\d+/, `versionCode ${newVersionCode}`);
|
||||||
gradle = gradle.replace(/versionName\s+"[^"]+"/, `versionName "${newVersion}"`);
|
gradle = gradle.replace(/versionName\s+"[^"]+"/, `versionName "${newVersion}"`);
|
||||||
fs.writeFileSync(gradlePath, gradle);
|
fs.writeFileSync(gradlePath, gradle);
|
||||||
|
}
|
||||||
|
|
||||||
console.log(newVersion);
|
console.log(newVersion);
|
||||||
|
|||||||
Reference in New Issue
Block a user