55 branches :
66 - main
77 - dev
8+ - staging
89
910
1011jobs :
@@ -37,10 +38,10 @@ jobs:
3738 docker builder prune -af || true
3839 df -h
3940
40- - uses : actions/checkout@v4
41+ - uses : actions/checkout@v6
4142 with :
4243 submodules : true
43- token : ${{ secrets.PAT_TOKEN }}
44+ token : ${{ secrets.PAT_TOKEN }}
4445
4546 - uses : actions/setup-node@v4
4647 with :
6263
6364 - name : Install worker dependencies
6465 run : |
65- git config --global url."https://github.com/".insteadOf git@github.com:
66- git config --global url."https://".insteadOf ssh://
66+ git config --global url."https://${{ secrets.PAT_TOKEN }}:x-oauth-basic@ github.com/".insteadOf "ssh:// git@github.com/"
67+ git config --global url."https://${{ secrets.PAT_TOKEN }}:x-oauth-basic@github.com/ ".insteadOf "git@github.com:"
6768 git config --global url."https://${{ secrets.PAT_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
6869 npm install --install-links --legacy-peer-deps
6970 env :
@@ -145,45 +146,71 @@ jobs:
145146 # CHANGED: add branch-aware profile
146147 eas build --platform android --profile ${{ steps.branch_profile.outputs.PROFILE }} --local --non-interactive
147148
148- - name : Build APK for GitHub release (only when production profile)
149- if : steps.branch_profile.outputs.PROFILE == 'production'
149+ - name : Resolve APK profile by branch
150+ id : apk_profile
151+ run : |
152+ if [ "${GITHUB_REF##*/}" = "main" ]; then
153+ APK_PROFILE=production-apk
154+ else
155+ APK_PROFILE=preview-apk
156+ fi
157+ echo "APK_PROFILE=$APK_PROFILE" >> "$GITHUB_OUTPUT"
158+
159+ - name : Build APK for GitHub release
150160 env :
151161 EXPO_TOKEN : ${{ secrets.EXPO_TOKEN }}
152162 run : |
153- eas build --platform android --profile preview --local --non-interactive
163+ eas build --platform android --profile ${{ steps.apk_profile.outputs.APK_PROFILE }} --local --non-interactive
154164
155- - name : Find and rename Android artifact
165+ - name : Find and rename Android artifacts
156166 id : find_android
157167 run : |
158168 set -euo pipefail
169+ VERSION="${{ steps.meta.outputs.VERSION }}"
170+
159171 AAB_PATH=$(find "$GITHUB_WORKSPACE" -name "*.aab" -type f | head -n 1 || true)
160172 echo "Original AAB: $AAB_PATH"
161-
162173 if [ -n "$AAB_PATH" ]; then
163- VERSION="${{ steps.meta.outputs.VERSION }}"
164- NEW_NAME="PearPass-Mobile-Android-v${VERSION}.aab"
165- NEW_PATH="$GITHUB_WORKSPACE/$NEW_NAME"
166-
167- mv "$AAB_PATH" "$NEW_PATH"
168- echo "Renamed AAB to: $NEW_PATH"
169-
170- echo "AAB_PATH=$NEW_PATH" >> "$GITHUB_OUTPUT"
174+ NEW_AAB="PearPass-Mobile-Android-v${VERSION}.aab"
175+ NEW_AAB_PATH="$GITHUB_WORKSPACE/$NEW_AAB"
176+ mv "$AAB_PATH" "$NEW_AAB_PATH"
177+ echo "AAB_PATH=$NEW_AAB_PATH" >> "$GITHUB_OUTPUT"
171178 else
172179 echo "No .aab file found."
173180 echo "AAB_PATH=" >> "$GITHUB_OUTPUT"
174181 fi
175182
183+ APK_PATH=$(find "$GITHUB_WORKSPACE" -name "*.apk" -type f | head -n 1 || true)
184+ echo "Original APK: $APK_PATH"
185+ if [ -n "$APK_PATH" ]; then
186+ NEW_APK="PearPass-Mobile-Android-v${VERSION}.apk"
187+ NEW_APK_PATH="$GITHUB_WORKSPACE/$NEW_APK"
188+ mv "$APK_PATH" "$NEW_APK_PATH"
189+ echo "APK_PATH=$NEW_APK_PATH" >> "$GITHUB_OUTPUT"
190+ else
191+ echo "No .apk file found."
192+ echo "APK_PATH=" >> "$GITHUB_OUTPUT"
193+ fi
194+
176195 VERSION_CODE=$(jq -r '.expo.android.versionCode' app.json)
177196 TIMESTAMP=$(date +%Y%m%d-%H%M%S)
178197 echo "VERSION_CODE=$VERSION_CODE" >> "$GITHUB_OUTPUT"
179198 echo "TIMESTAMP=$TIMESTAMP" >> "$GITHUB_OUTPUT"
180199
181- - name : Upload Android artifacts
200+ - name : Upload Android AAB artifact
182201 uses : actions/upload-artifact@v4
183202 with :
184203 name : PearPass-Mobile-Android-v${{ steps.meta.outputs.VERSION }}.aab
185204 path : ${{ steps.find_android.outputs.AAB_PATH }}
186205 if-no-files-found : ignore
206+
207+ - name : Upload Android APK artifact
208+ if : steps.find_android.outputs.APK_PATH != ''
209+ uses : actions/upload-artifact@v4
210+ with :
211+ name : PearPass-Mobile-Android-v${{ steps.meta.outputs.VERSION }}.apk
212+ path : ${{ steps.find_android.outputs.APK_PATH }}
213+ if-no-files-found : error
187214
188215 - name : Submit to Google play via EAS
189216 env :
@@ -220,7 +247,7 @@ jobs:
220247 ios :
221248 runs-on : macos-latest
222249 steps :
223- - uses : actions/checkout@v4
250+ - uses : actions/checkout@v6
224251 with :
225252 submodules : true
226253 token : ${{ secrets.PAT_TOKEN }}
@@ -238,8 +265,8 @@ jobs:
238265
239266 - name : Install worker dependencies
240267 run : |
241- git config --global url."https://github.com/".insteadOf git@github.com:
242- git config --global url."https://".insteadOf ssh://
268+ git config --global url."https://${{ secrets.PAT_TOKEN }}:x-oauth-basic@ github.com/".insteadOf "ssh:// git@github.com/"
269+ git config --global url."https://${{ secrets.PAT_TOKEN }}:x-oauth-basic@github.com/ ".insteadOf "git@github.com:"
243270 git config --global url."https://${{ secrets.PAT_TOKEN }}:x-oauth-basic@github.com/".insteadOf "https://github.com/"
244271 npm install --install-links --legacy-peer-deps
245272 env :
@@ -386,13 +413,20 @@ jobs:
386413 needs : [android, ios]
387414 if : github.ref == 'refs/heads/main'
388415 steps :
389- - name : Download Android artifacts
416+ - name : Download Android AAB artifact
390417 uses : actions/download-artifact@v4
391418 with :
392419 name : PearPass-Mobile-Android-v${{ needs.android.outputs.version }}.aab
393420 path : ./dist
394421 continue-on-error : false
395422
423+ - name : Download Android APK artifact
424+ uses : actions/download-artifact@v4
425+ with :
426+ name : PearPass-Mobile-Android-v${{ needs.android.outputs.version }}.apk
427+ path : ./dist
428+ continue-on-error : false
429+
396430 - name : Download iOS artifacts
397431 uses : actions/download-artifact@v4
398432 with :
@@ -415,6 +449,7 @@ jobs:
415449 files : |
416450 dist/**/*.ipa
417451 dist/**/*.aab
452+ dist/**/*.apk
418453 env :
419454 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
420455
0 commit comments