Merge pull request #133 from Qsilver97/staging #23
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Android and iOS mobile app | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
react-native-android-build-apk: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 20 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '20' | |
distribution: 'temurin' | |
cache: gradle | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
with: | |
path: mobile/node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install npm dependencies | |
run: | | |
cd mobile && npm install | |
cd nodejs-assets/nodejs-project && npm install | |
- name: Cache Gradle Wrapper and Caches | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: Set execute permission for gradlew | |
run: | | |
chmod +x ./mobile/android/gradlew # Ensuring gradlew has execute permissions | |
- name: Build Android Release | |
run: | | |
cd mobile/android && ./gradlew assembleRelease | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Android-APKs | |
path: mobile/android/app/build/outputs/apk/release/*.apk | |
- name: Upload APKs to Server | |
env: | |
TOKEN: ${{ secrets.TOKEN }} | |
UPLOAD_URL: ${{ secrets.UPLOAD_URL }} | |
run: | | |
for apk in mobile/android/app/build/outputs/apk/release/*.apk; do | |
curl -F "file=@$apk" $UPLOAD_URL?token=$TOKEN | |
done |