Skip to content

Commit 9f68115

Browse files
committed
Refactor release workflow to build both AAB and APK, streamline environment variables, and improve artifact handling
1 parent 2eb8ed0 commit 9f68115

File tree

1 file changed

+75
-30
lines changed

1 file changed

+75
-30
lines changed

.github/workflows/release.yml

Lines changed: 75 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,58 +8,102 @@ on:
88
push:
99
branches:
1010
- main
11-
- release/*
1211

1312
permissions:
1413
contents: write
1514

15+
env: # avoid repeating these in every job
16+
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
17+
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
18+
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
19+
LOCAL_PROPERTIES: ${{ secrets.LOCAL_PROPERTIES }}
20+
JKS_B64: ${{ secrets.KEYSTORE_BASE64 }}
21+
1622
jobs:
17-
build:
23+
build-aab:
1824
runs-on: ubuntu-latest
19-
2025
steps:
21-
# 1. Check out the repository
22-
- name: Checkout code
23-
uses: actions/checkout@v4
26+
- uses: actions/checkout@v4
2427

25-
# 2. Create local.properties with the proper sdk.dir (update the path if needed)
26-
- name: Create local.properties file
27-
run: echo "${{ secrets.LOCAL_PROPERTIES }}" > local.properties
28+
- name: Create local.properties
29+
run: echo "$LOCAL_PROPERTIES" > local.properties
2830

29-
# 3. Set up JDK 21
3031
- name: Set up JDK 21
3132
uses: actions/setup-java@v4
3233
with:
3334
distribution: temurin
3435
java-version: '21'
3536
cache: gradle
3637

37-
# 4. Setup Gradle
38-
- name: Setup Gradle
39-
uses: gradle/actions/setup-gradle@v4
38+
- name: Decode keystore
39+
run: echo "$JKS_B64" | base64 --decode > app/keystore.jks
40+
41+
- name: Increment Version Numbers
42+
id: increment_version
43+
run: bash increment_version.sh
4044

41-
# 5. Decode the Base64‑encoded JKS keystore and save it as app/keystore.jks
42-
- name: Decode JKS keystore
43-
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > app/keystore.jks
45+
- name: Build bundleRelease
46+
run: ./gradlew --no-daemon --configuration-cache bundleRelease
4447

45-
# 6. Make the Gradle wrapper executable
46-
- name: Make gradlew executable
47-
run: chmod +x gradlew
48+
- name: Upload AAB + symbols
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: aab
52+
path: |
53+
app/release/app-release.aab
54+
app/release/native-debug-symbols.zip
55+
56+
build-apk:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- uses: actions/checkout@v4
60+
61+
- name: Create local.properties
62+
run: echo "$LOCAL_PROPERTIES" > local.properties
63+
64+
- name: Set up JDK 21
65+
uses: actions/setup-java@v4
66+
with:
67+
distribution: temurin
68+
java-version: '21'
69+
cache: gradle
4870

49-
# 7. Increment version numbers by calling the shell script
5071
- name: Increment Version Numbers
5172
id: increment_version
5273
run: bash increment_version.sh
5374

54-
# 8. Build the release App Bundle using configuration caching
55-
- name: Build Android App
56-
env:
57-
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
58-
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
59-
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
60-
run: ./gradlew --configuration-cache bundleRelease
75+
- name: Decode keystore
76+
run: echo "$JKS_B64" | base64 --decode > app/keystore.jks
77+
78+
- name: Build assembleRelease
79+
run: ./gradlew --no-daemon --configuration-cache assembleRelease
80+
81+
- name: Upload APK
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: apk
85+
path: app/build/outputs/apk/release/app-release.apk
86+
87+
release:
88+
needs: [ build-aab, build-apk ]
89+
runs-on: ubuntu-latest
90+
steps:
91+
- uses: actions/checkout@v4
92+
93+
- name: Download AAB artifact
94+
uses: actions/download-artifact@v4
95+
with:
96+
name: aab
97+
98+
- name: Download APK artifact
99+
uses: actions/download-artifact@v4
100+
with:
101+
name: apk
102+
103+
- name: Increment Version Numbers
104+
id: increment_version
105+
run: bash increment_version.sh
61106

62-
# 9. Create a GitHub Release and upload the bundle using the new version as the tag name
63107
- name: Create GitHub Release and upload the bundle
64108
id: create_release
65109
uses: softprops/action-gh-release@v2
@@ -68,8 +112,9 @@ jobs:
68112
with:
69113
tag_name: ${{ steps.increment_version.outputs.new_version }}
70114
files: |
71-
app/release/app-release.aab
72-
app/release/native-debug-symbols.zip
115+
**/app-release.aab
116+
**/native-debug-symbols.zip
117+
app-release.apk
73118
74119
- name: Commit Version Number Increment and Push
75120
run: |

0 commit comments

Comments
 (0)