#SBCOSS-362 : upgraded script #34
Workflow file for this run
This file contains hidden or 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: Android | |
on: | |
push: | |
tags: | |
- '*' | |
jobs: | |
build: | |
environment: sunbird | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '21' | |
distribution: 'zulu' | |
cache: gradle | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Install Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 22.x | |
- name: Install Ionic | |
run: npm install -g @ionic/cli | |
- name: Install app dependencies | |
run: npm install --legacy-peer-deps | |
- name: Convert Windows line endings to Linux from the gradlew file | |
run: sudo apt update && sudo apt install dos2unix && cd android && dos2unix ./gradlew && cd .. | |
- name: Make ./gradlew command executable | |
run: cd android && chmod +x ./gradlew && cd .. | |
- name: Decode google-service | |
id: decode_google-service | |
uses: timheuer/base64-to-file@v1.2 | |
with: | |
fileName: 'google-services.json' | |
fileDir: '/home/runner/work/SunbirdEd-mobile-app/SunbirdEd-mobile-app/configurations/' | |
encodedString: ${{ secrets.GOOGLE_SERVICE_CONTENT }} | |
- name: Copy google-services.json | |
run: cp configurations/google-services.json android/app/google-services.json | |
- name: Decode env file | |
id: decode_env | |
uses: timheuer/base64-to-file@v1.2 | |
with: | |
fileName: 'configuration.prod.ts' | |
fileDir: '/home/runner/work/SunbirdEd-mobile-app/SunbirdEd-mobile-app/configurations/' | |
encodedString: ${{ secrets.ENV }} | |
- name: Build Ionic assets | |
run: ionic build --prod && npx cap sync | |
- name: Decode Keystore | |
id: decode_keystore | |
uses: timheuer/base64-to-file@v1.2 | |
with: | |
fileName: 'android_keystore.jks' | |
fileDir: '/home/runner/work/SunbirdEd-mobile-app/SunbirdEd-mobile-app/android/app/keystore/' | |
encodedString: ${{ secrets.KEYSTORE }} | |
- name: Create signing.properties | |
run: | | |
mkdir -p ${{ github.workspace }}/android/app/keystore | |
echo "KEYSTORE_FILE=${{ github.workspace }}/android/app/keystore/android_keystore.jks" > ${{ github.workspace }}/android/signing.properties | |
echo "KEYSTORE_PASSWORD=${{ secrets.SIGNING_STORE_PASSWORD }}" >> ${{ github.workspace }}/android/signing.properties | |
echo "KEYSTORE_ALIAS=${{ secrets.SIGNING_KEY_ALIAS }}" >> ${{ github.workspace }}/android/signing.properties | |
echo "KEYSTORE_ALIAS_PASSWORD=${{ secrets.SIGNING_KEY_PASSWORD }}" >> ${{ github.workspace }}/android/signing.properties | |
- name: Inject secrets into gradle.properties | |
run: | | |
echo "base_url=${{ secrets.BASE_URL }}" >> $GITHUB_WORKSPACE/android/gradle.properties | |
echo "mobile_app_key=${{ secrets.MOBILE_APP_KEY }}" >> $GITHUB_WORKSPACE/android/gradle.properties | |
echo "mobile_app_secret=${{ secrets.MOBILE_APP_SECRET }}" >> $GITHUB_WORKSPACE/android/gradle.properties | |
# - name: Build bundle | |
# run: cd android && ./gradlew app:bundleRelease | |
# env: | |
# SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }} | |
# SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | |
# SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }} | |
# # - name: Build APK | |
# # run: cd android && ./gradlew assembleDebug | |
# - name: Upload APK | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: app-release | |
# path: ${{ github.workspace }}/android/app/build/outputs/ | |
# ... keep everything above as-is | |
- name: Fix missing resources in capacitor-cordova-android-plugins | |
run: | | |
echo "Copying resources to capacitor-cordova-android-plugins..." | |
mkdir -p android/capacitor-cordova-android-plugins/src/main/res | |
cp -r android/app/src/main/res/* android/capacitor-cordova-android-plugins/src/main/res/ | |
- name: Build debug APK | |
run: cd android && ./gradlew assembleDebug | |
- name: List APK build outputs | |
run: ls -R android/app/build/outputs/apk/ | |
- name: Upload Debug APK | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: debug-apk | |
path: android/app/build/outputs/ | |
# - name: Fix missing resources in capacitor-cordova-android-plugins | |
# run: | | |
# echo "Copying resources to capacitor-cordova-android-plugins..." | |
# mkdir -p android/capacitor-cordova-android-plugins/src/main/res | |
# cp -r android/app/src/main/res/* android/capacitor-cordova-android-plugins/src/main/res/ | |
# - name: Build release APK | |
# run: cd android && ./gradlew assembleRelease | |
# - name: Upload APKs | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: android-apks | |
# path: | | |
# android/app/build/outputs/apk/release/app-release.apk | |