Skip to content

Commit b1496c3

Browse files
Disable Gradle Daemon in CI and fix build script
This commit introduces changes to the CI workflows and the local build script to improve build reliability and correctness. The Gradle Daemon has been disabled in all GitHub Actions workflows (`nightly-release`, `android-release_ci`, `android-branch_ci`, `android-pr_ci`) by adding the `--no-daemon` flag and a preceding `--stop` command. This helps to ensure a clean build environment for each run. Additionally, `BuildApp.bat` has been updated to correctly locate build artifacts. It now converts the `BUILD_TYPE` variable to lowercase before constructing the output paths for the APK and AAB files, fixing an issue where it failed to find the generated files.
1 parent cf12863 commit b1496c3

File tree

5 files changed

+33
-18
lines changed

5 files changed

+33
-18
lines changed

.github/workflows/android-branch_ci.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,16 @@ jobs:
3939
- name: Grant execute permission for gradlew
4040
run: chmod +x gradlew
4141

42+
- name: Stop Gradle daemons
43+
run: ./gradlew --stop
44+
4245
- name: Build with Gradle
43-
run: ./gradlew clean && ./gradlew assembleProdDebug --refresh-dependencies
46+
run: ./gradlew clean assembleProdDebug --refresh-dependencies --no-daemon
47+
env:
48+
KEY_STORE_FILE: ${{ secrets.SIGNINGKEY_BASE64 }} # optional if using a file from env
49+
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
50+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
51+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
4452

4553
- name: Upload Artifact
4654
uses: actions/upload-artifact@v6.0.0

.github/workflows/android-pr_ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ jobs:
3737
- name: Grant execute permission for gradlew
3838
run: chmod +x gradlew
3939

40+
- name: Stop Gradle daemons
41+
run: ./gradlew --stop
42+
4043
- name: Build with Gradle
41-
run: ./gradlew clean && ./gradlew assembleProdDebug --refresh-dependencies
44+
run: ./gradlew clean assembleProdDebug --refresh-dependencies --no-daemon
4245
env:
4346
KEY_STORE_FILE: ${{ secrets.SIGNINGKEY_BASE64 }} # optional if using a file from env
4447
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}

.github/workflows/android-release_ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ jobs:
3737
- name: Grant execute permission for gradlew
3838
run: chmod +x gradlew
3939

40+
- name: Stop Gradle daemons
41+
run: ./gradlew --stop
42+
4043
- name: Build
41-
run: ./gradlew clean && ./gradlew assembleProdRelease --refresh-dependencies && ./gradlew bundleProdRelease --refresh-dependencies
44+
run: ./gradlew clean assembleProdRelease --refresh-dependencies --no-daemon && ./gradlew clean bundleProdRelease --refresh-dependencies --no-daemon
4245
env:
4346
KEY_STORE_FILE: ${{ secrets.SIGNINGKEY_BASE64 }} # optional if using a file from env
4447
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}

.github/workflows/nightly-release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ jobs:
5151
- name: Grant execute permission for gradlew
5252
run: chmod +x gradlew
5353

54+
- name: Stop Gradle daemons
55+
run: ./gradlew --stop
56+
5457
- name: Build with Gradle
55-
run: ./gradlew clean && ./gradlew assembleNightlyRelease --refresh-dependencies
58+
run: ./gradlew clean assembleNightlyRelease --refresh-dependencies --no-daemon
5659
env:
5760
KEY_STORE_FILE: ${{ secrets.SIGNINGKEY_BASE64 }} # optional if using a file from env
5861
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}

BuildApp.bat

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,21 @@ call ./gradlew clean
4141
call ./gradlew assemble%BUILD_TYPE%Release --no-configuration-cache --refresh-dependencies
4242
call ./gradlew bundle%BUILD_TYPE%Release --no-configuration-cache --refresh-dependencies
4343

44-
REM ----------------------------
45-
REM 4️⃣ Output paths
46-
REM ----------------------------
47-
SET APK_PATH=app\build\outputs\apk\%BUILD_TYPE%\release\app-%BUILD_TYPE%-release.apk
48-
SET BUNDLE_PATH=app\build\outputs\bundle\%BUILD_TYPE%\release\app-%BUILD_TYPE%-release.aab
44+
REM Enable delayed expansion
45+
SETLOCAL EnableDelayedExpansion
4946

50-
IF EXIST %APK_PATH% (
51-
echo APK built successfully: %APK_PATH%
52-
) ELSE (
53-
echo WARNING: APK not found!
47+
REM Convert BUILD_TYPE to lowercase
48+
for /f %%i in ('powershell -NoProfile -Command "%BUILD_TYPE%.ToLower()"') do (
49+
SET BUILD_TYPE_LOWER=%%i
5450
)
5551

56-
IF EXIST %BUNDLE_PATH% (
57-
echo Bundle built successfully: %BUNDLE_PATH%
58-
) ELSE (
59-
echo WARNING: Bundle not found!
60-
)
52+
REM Use lowercase variable for paths
53+
SET APK_PATH=app\build\outputs\apk\!BUILD_TYPE_LOWER!\release\app-!BUILD_TYPE_LOWER!-release.apk
54+
SET BUNDLE_PATH=app\build\outputs\bundle\!BUILD_TYPE_LOWER!\release\app-!BUILD_TYPE_LOWER!-release.aab
55+
56+
57+
echo APK built successfully: %APK_PATH%
58+
echo Bundle built successfully: %BUNDLE_PATH%
6159

6260
echo Build finished.
6361
pause

0 commit comments

Comments
 (0)