release(app): v4.3.0+40300 (#1293) #48
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: Deploy Mobile App | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- prod | |
paths: | |
- "mobile-app/**" | |
jobs: | |
flutter_deploy: | |
name: Deploy flutter app | |
defaults: | |
run: | |
working-directory: ./mobile-app | |
runs-on: ubuntu-latest | |
steps: | |
- name: Remove unused software | |
working-directory: / | |
run: | | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
echo "Free space:" | |
df -h / | |
- name: Checkout files | |
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | |
- name: Enable KVM | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
- name: Gradle cache | |
uses: gradle/actions/setup-gradle@db19848a5fa7950289d3668fb053140cf3028d43 # v3 | |
with: | |
gradle-version: 7.6.3 | |
- name: Setup Java 17 | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: AVD cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-33 | |
- name: Ceate AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@77986be26589807b8ebab3fde7bbf5c60dabec32 # v2 | |
with: | |
api-level: 33 | |
target: google_apis | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: false | |
script: echo "Generated AVD snapshot for caching." | |
- name: Setup Flutter 3.22.x | |
uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # v2 | |
with: | |
flutter-version: "3.22.x" | |
channel: "stable" | |
cache: true | |
cache-key: flutter-3.22.x | |
cache-path: ${{ runner.tool_cache }}/flutter | |
- name: Create .env file | |
run: | | |
echo "HASHNODE_PUBLICATION_ID=$HASHNODE_PUBLICATION_ID" > .env | |
echo "ALGOLIAAPPID=$ALGOLIA_APP_ID" >> .env | |
echo "ALGOLIAKEY=$ALGOLIA_KEY" >> .env | |
echo "AUTH0_DOMAIN=$AUTH0_DOMAIN" >> .env | |
echo "AUTH0_CLIENT_ID=$AUTH0_CLIENT_ID" >> .env | |
env: | |
HASHNODE_PUBLICATION_ID: ${{ secrets.HASHNODE_PUBLICATION_ID }} | |
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} | |
ALGOLIA_KEY: ${{ secrets.ALGOLIA_KEY }} | |
AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }} | |
AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }} | |
- name: Install packages | |
run: flutter pub get | |
- name: Analyze code | |
run: flutter analyze | |
- name: Run unit tests | |
run: | | |
cd test | |
flutter test unit | |
flutter test services | |
- name: Run tests in emulator | |
uses: reactivecircus/android-emulator-runner@77986be26589807b8ebab3fde7bbf5c60dabec32 # v2 | |
with: | |
api-level: 33 | |
target: google_apis | |
arch: x86_64 | |
force-avd-creation: false | |
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
disable-animations: true | |
script: cd mobile-app && if adb shell pm list packages | grep -q org.freecodecamp; then adb uninstall org.freecodecamp; fi && dart integration_test_runner.dart | |
- name: Upload screenshots | |
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 | |
if: always() | |
with: | |
name: screenshots | |
path: mobile-app/screenshots/ | |
retention-days: 7 | |
- name: Setup Ruby for Fastlane | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.1.3" | |
bundler-cache: true | |
working-directory: ./mobile-app/android | |
- name: Configure keystore | |
working-directory: ./mobile-app/android | |
run: | | |
echo "$KEYSTORE" | base64 --decode > app/keystore.jks | |
echo "$GPLAY_STORE_CONFIG" | base64 --decode > play-store-credentials.json | |
echo "storeFile=keystore.jks" > key.properties | |
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> key.properties | |
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> key.properties | |
echo "keyAlias=$KEYSTORE_KEY_ALIAS" >> key.properties | |
env: | |
KEYSTORE: ${{ secrets.KEYSTORE }} | |
GPLAY_STORE_CONFIG: ${{ secrets.GPLAY_STORE_CONFIG }} | |
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }} | |
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }} | |
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }} | |
- name: Deploy app to internal testing | |
run: | | |
flutter build appbundle | |
cd android | |
bundle exec fastlane deploy |