|
8 | 8 | push: |
9 | 9 | branches: |
10 | 10 | - main |
11 | | - - release/* |
12 | 11 |
|
13 | 12 | permissions: |
14 | 13 | contents: write |
15 | 14 |
|
| 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 | + |
16 | 22 | jobs: |
17 | | - build: |
| 23 | + build-aab: |
18 | 24 | runs-on: ubuntu-latest |
19 | | - |
20 | 25 | steps: |
21 | | - # 1. Check out the repository |
22 | | - - name: Checkout code |
23 | | - uses: actions/checkout@v4 |
| 26 | + - uses: actions/checkout@v4 |
24 | 27 |
|
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 |
28 | 30 |
|
29 | | - # 3. Set up JDK 21 |
30 | 31 | - name: Set up JDK 21 |
31 | 32 | uses: actions/setup-java@v4 |
32 | 33 | with: |
33 | 34 | distribution: temurin |
34 | 35 | java-version: '21' |
35 | 36 | cache: gradle |
36 | 37 |
|
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 |
40 | 44 |
|
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 |
44 | 47 |
|
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 |
48 | 70 |
|
49 | | - # 7. Increment version numbers by calling the shell script |
50 | 71 | - name: Increment Version Numbers |
51 | 72 | id: increment_version |
52 | 73 | run: bash increment_version.sh |
53 | 74 |
|
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 |
61 | 106 |
|
62 | | - # 9. Create a GitHub Release and upload the bundle using the new version as the tag name |
63 | 107 | - name: Create GitHub Release and upload the bundle |
64 | 108 | id: create_release |
65 | 109 | uses: softprops/action-gh-release@v2 |
|
68 | 112 | with: |
69 | 113 | tag_name: ${{ steps.increment_version.outputs.new_version }} |
70 | 114 | 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 |
73 | 118 |
|
74 | 119 | - name: Commit Version Number Increment and Push |
75 | 120 | run: | |
|
0 commit comments