Skip to content

Commit f76691f

Browse files
committed
chore(workflow): update workflow to build debug instead of release if the secrets has not yet been setup
1 parent fab3f6a commit f76691f

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

.github/workflows/build.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,30 +25,39 @@ jobs:
2525
uses: gradle/gradle-build-action@v3
2626

2727
- name: Decode Keystore
28+
if: secrets.SIGNING_KEYSTORE != ''
2829
run: echo "${{ secrets.SIGNING_KEYSTORE }}" | base64 --decode > app/release.keystore
2930

3031
- name: Setup Gradle Signing Config
32+
if: secrets.SIGNING_KEYSTORE != ''
3133
run: |
3234
echo -e "\nSTORE_FILE=release.keystore" >> gradle.properties
3335
echo "STORE_PASSWORD=${{ secrets.STORE_PASSWORD }}" >> gradle.properties
3436
echo "KEY_ALIAS=${{ secrets.KEY_ALIAS }}" >> gradle.properties
3537
echo "KEY_PASSWORD=${{ secrets.KEY_PASSWORD }}" >> gradle.properties
3638
3739
- name: Build Release APK
40+
if: secrets.SIGNING_KEYSTORE != ''
3841
run: ./gradlew assembleRelease --stacktrace
3942

43+
- name: Build Debug APK
44+
if: secrets.SIGNING_KEYSTORE == ''
45+
run: ./gradlew assembleDebug --stacktrace
46+
4047
- name: Build App Bundle
48+
if: secrets.SIGNING_KEYSTORE != ''
4149
run: ./gradlew bundleRelease --stacktrace
4250

43-
- name: Upload Release APK
51+
- name: Upload APK
4452
uses: actions/upload-artifact@v4
4553
with:
46-
name: app-release.apk
47-
path: app/build/outputs/apk/release/app-release.apk
54+
name: ${{ secrets.SIGNING_KEYSTORE != '' && 'app-release.apk' || 'app-debug.apk' }}
55+
path: ${{ secrets.SIGNING_KEYSTORE != '' && 'app/build/outputs/apk/release/app-release.apk' || 'app/build/outputs/apk/debug/app-debug.apk' }}
4856
if-no-files-found: error
4957
compression-level: 0
5058

5159
- name: Upload Release App Bundle
60+
if: secrets.SIGNING_KEYSTORE != ''
5261
uses: actions/upload-artifact@v4
5362
with:
5463
name: app-release.aab
@@ -57,6 +66,7 @@ jobs:
5766
compression-level: 0
5867

5968
- name: Push APK to released repo
69+
if: secrets.RELEASED_REPO_TOKEN != ''
6070
run: |
6171
git config --global user.name "github-actions[bot]"
6272
git config --global user.email "github-actions[bot]@users.noreply.github.com"

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ into a fully functional APK, while adding mobile-specific features and customiza
6060

6161
---
6262

63-
## Required GitHub Secrets
63+
## GitHub Secrets
6464

65-
Before running the workflow, set up the following **repository secrets**:
65+
Before running the workflow, set up the following **repository secrets** else itll fallback to build `debug`:
6666

67-
| Secret Name | Description |
68-
|--------------|-------------|
69-
| `SIGNING_KEYSTORE` | Base64-encoded contents of your `keystore.jks` file. |
70-
| `STORE_PASSWORD` | The password for your keystore. |
71-
| `KEY_ALIAS` | The alias name used for the signing key. |
72-
| `KEY_PASSWORD` | The password for your key alias. |
67+
| Secret Name | Description |
68+
| --------------------- | ----------------------------------------------------------------------------------------------------------------------- |
69+
| `SIGNING_KEYSTORE` | Base64-encoded contents of your `keystore.jks` file. |
70+
| `STORE_PASSWORD` | The password for your keystore. |
71+
| `KEY_ALIAS` | The alias name used for the signing key. |
72+
| `KEY_PASSWORD` | The password for your key alias. |
7373
| `RELEASED_REPO_TOKEN` | GitHub Personal Access Token (PAT) with write permissions to the released repository (used for pushing the signed APK). |
7474

7575
---

0 commit comments

Comments
 (0)