release(app): v4.1.2+40102 (#1110) #35
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: macos-latest | |
steps: | |
- name: Checkout files | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 | |
- name: Setup Java 11 | |
uses: actions/setup-java@5ffc13f4174014e2d4d4572b3d74c3fa61aeb2c2 # v3 | |
with: | |
distribution: "temurin" | |
java-version: "11" | |
cache: "gradle" | |
- name: AVD cache | |
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3 | |
id: avd-cache | |
with: | |
path: | | |
~/.android/avd/* | |
~/.android/adb* | |
key: avd-31 | |
- name: Ceate AVD and generate snapshot for caching | |
if: steps.avd-cache.outputs.cache-hit != 'true' | |
uses: reactivecircus/android-emulator-runner@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b # v2 | |
with: | |
api-level: 31 | |
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.10.x | |
uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa # v2 | |
with: | |
flutter-version: "3.10.x" | |
channel: "stable" | |
cache: true | |
cache-key: flutter-3.10.x | |
cache-path: ${{ runner.tool_cache }}/flutter | |
- name: Create .env file | |
run: | | |
echo "NEWSURL=https://www.freecodecamp.org/news/ghost/api/v3/content/" > .env | |
echo "NEWSKEY=$GHOST_NEWSKEY" >> .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: | |
GHOST_NEWSKEY: ${{ secrets.GHOST_NEWSKEY }} | |
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@d94c3fbe4fe6a29e4a5ba47c12fb47677c73656b # v2 | |
with: | |
api-level: 31 | |
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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3 | |
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: "2.6" | |
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 |