Skip to content

fixing app dependencies #88

fixing app dependencies

fixing app dependencies #88

Workflow file for this run

# https://firebase.google.com/docs/cli?hl=ru#cli-ci-systems
# https://www.youtube.com/watch?v=OUqPB-DAWIg - about base64
# Some code was taken from - https://github.com/PlugFox/template/tree/master/.github
name: Flutter CI/CD
on:
push: # merge or push will work
branches:
- main
# pull_request: # means that pull_request will work only when it will be a PR to the main branch
# branches:
# - main
# types:
# - closed # means that pull_request works only when PR is closed or merged
jobs:
build-and-deploy:
runs-on: ubuntu-latest # macos-latest
timeout-minutes: 30
steps:
- name: Get the .github actions
uses: actions/checkout@v4
with:
sparse-checkout: |
.github
- name: Setup Flutter and dependencies
uses: ./.github/actions/setup
with:
flutter-version: "3.35.5"
- name: Install dependencies
timeout-minutes: 1
run: flutter pub get
- name: Check code format
id: check-format
timeout-minutes: 1
run: |
if ! find lib test -name "*.dart" ! -name "*.*.dart" -print0 | xargs -0 dart format --set-exit-if-changed --line-length 100 -o none; then
echo "⚠️ Code needs formatting. Run 'dart format' locally."
fi
# - name: Run build_runner
# run: dart run build_runner build --delete-conflicting-outputs
- name: Check for Warnings
id: check-analyzer
timeout-minutes: 1
run: |
flutter analyze --no-fatal-infos --no-fatal-warnings || true
- name: Run tests
run: flutter test
# ---------------- FIREBASE AUTH ---------------- #
- name: Setup Firebase CLI
run: |
curl -sL https://firebase.tools | bash
firebase --version
- name: Authenticate with Firebase
run: |
echo '${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}' > $HOME/firebase_key.json
export GOOGLE_APPLICATION_CREDENTIALS=$HOME/firebase_key.json
- name: Create firebase_options
run: 'echo "$FIREBASE_OPTIONS_BASE64" | base64 --decode > lib/firebase_options.dart'
env:
FIREBASE_OPTIONS_BASE64: ${{ secrets.FIREBASE_OPTIONS_BASE64 }}
- name: Create google_service_json for Android
run: 'echo "$GOOGLE_SERVICES_JSON_BASE64" | base64 --decode > android/app/google-services.json'
env:
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
- name: Create key_properties for ANDROID
run: 'echo "$KEY_PROPERTIES" | base64 --decode > android/key.properties'
env:
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }}
- name: Create upload-keystore for ANDROID
run: 'echo "$UPLOAD_KEYSTORE" | base64 --decode > android/app/upload-keystore.jks'
env:
UPLOAD_KEYSTORE: ${{ secrets.UPLOAD_KEYSTORE }}
- name: Create GoogleService-Info for IOS
run: 'echo "$GOOGLE_SERVICE_PLIST_BASE64" | base64 --decode > ios/Runner/GoogleService-Info.plist'
env:
GOOGLE_SERVICE_PLIST_BASE64: ${{ secrets.GOOGLE_SERVICE_PLIST_BASE64 }}
# ---------------- ANDROID BUILD ---------------- #
- name: Build APK
run: flutter build apk --release
# ---------------- iOS BUILD ---------------- #
# - name: Install CocoaPods dependencies
# run: cd ios && pod install
# - name: Build iOS app
# run: |
# flutter build ios --release --no-codesign
# - name: Archive iOS App
# run: |
# xcodebuild -workspace ios/Runner.xcworkspace \
# -scheme Runner \
# -sdk iphoneos \
# -configuration Release \
# -archivePath build/Runner.xcarchive \
# archive \
# CODE_SIGNING_REQUIRED=NO \
# CODE_SIGNING_ALLOWED=NO
# - name: Export .ipa file
# run: |
# xcodebuild -exportArchive \
# -archivePath build/Runner.xcarchive \
# -exportPath build/ \
# -exportOptionsPlist ios/exportOptions.plist
# CODE_SIGNING_REQUIRED=NO \
# CODE_SIGNING_ALLOWED=NO
# Throwing error: Failed to authenticate, have you run firebase login?
# - name: Upload APK to Firebase App Distribution
# run: |
# firebase appdistribution:distribute build/app/outputs/flutter-apk/app-release.apk \
# --app ${{ secrets.ANDROID_FIREBASE_APP_ID }} \
# --groups group-testers
# env:
# GOOGLE_APPLICATION_CREDENTIALS: $HOME/firebase_key.json
# Works find as well (using third parties helpers)
- name: Deploy Android App to Firebase
uses: wzieba/Firebase-Distribution-Github-Action@v1 # Use Firebase Distribution GitHub Action to deploy ||||||| Error: Container action is only supported on Linux
with:
appId: ${{secrets.ANDROID_FIREBASE_APP_ID}} # Firebase App ID for Android
serviceCredentialsFileContent: ${{secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON}} # Firebase service account key for authentication
groups: group-testers # Distribution group(s) to receive the app
file: build/app/outputs/flutter-apk/app-release.apk # Path to the built APK file
# - name: Deploy iOS App to Firebase
# uses: wzieba/Firebase-Distribution-Github-Action@v1
# with:
# appId: ${{ secrets.IOS_FIREBASE_APP_ID }}
# serviceCredentialsFileContent: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS_JSON }}
# groups: group-testers
# file: build/Runner.ipa