diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd15f2e..f054d0e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: run: | git config user.name "github-actions[bot]" 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 push @@ -49,6 +49,9 @@ jobs: - name: Setup Android SDK uses: android-actions/setup-android@v3 + - name: Expo Prebuild + run: npx expo prebuild --platform android --no-install + - name: Grant Gradle execute permission run: chmod +x android/gradlew diff --git a/scripts/bump-version.js b/scripts/bump-version.js index c8e0273..f2120bd 100644 --- a/scripts/bump-version.js +++ b/scripts/bump-version.js @@ -25,11 +25,13 @@ const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8')); pkgJson.version = newVersion; 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'); -let gradle = fs.readFileSync(gradlePath, 'utf8'); -gradle = gradle.replace(/versionCode\s+\d+/, `versionCode ${newVersionCode}`); -gradle = gradle.replace(/versionName\s+"[^"]+"/, `versionName "${newVersion}"`); -fs.writeFileSync(gradlePath, gradle); +if (fs.existsSync(gradlePath)) { + let gradle = fs.readFileSync(gradlePath, 'utf8'); + gradle = gradle.replace(/versionCode\s+\d+/, `versionCode ${newVersionCode}`); + gradle = gradle.replace(/versionName\s+"[^"]+"/, `versionName "${newVersion}"`); + fs.writeFileSync(gradlePath, gradle); +} console.log(newVersion);