Update workflow #37
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 Flutter APK's and iPA files | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- '*' | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: "stable" | |
architecture: x64 | |
cache: true | |
- uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
cache: 'gradle' | |
- name: Run flutter doctor | |
run: flutter doctor -v | |
- name: Run pub get and build runner | |
run: | | |
flutter pub get | |
dart run build_runner build --delete-conflicting-outputs | |
- name: Write secrets to files | |
shell: bash | |
run: | | |
echo $GOOGLE_SERVICE_ANDROID | base64 -d > android/app/google-services.json | |
echo $FIREBASE_APP_ID | base64 -d > ios/firebase_app_id_file.json | |
echo $FIREBASE_OPTIONS | base64 -d > lib/firebase_options.dart | |
env: | |
GOOGLE_SERVICE_ANDROID: ${{ secrets.GOOGLE_SERVICE_ANDROID }} | |
FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }} | |
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }} | |
# - name: Write google-services file for Android | |
# uses: mobiledevops/secret-to-file-action@v1 | |
# with: | |
# base64-encoded-secret: ${{ secrets.GOOGLE_SERVICE_ANDROID }} | |
# filename: "google-services.json" | |
# is-executable: false | |
# working-directory: "android/app" | |
# - name: Write firebase app id file for for iOS | |
# uses: mobiledevops/secret-to-file-action@v1 | |
# with: | |
# base64-encoded-secret: ${{ secrets.FIREBASE_APP_ID }} | |
# filename: "firebase_app_id_file.json" | |
# is-executable: false | |
# working-directory: "ios" | |
# | |
# - name: Write firebase options file | |
# uses: mobiledevops/secret-to-file-action@v1 | |
# with: | |
# base64-encoded-secret: ${{ secrets.FIREBASE_OPTIONS }} | |
# filename: "firebase_options.dart" | |
# is-executable: false | |
# working-directory: "lib" | |
# | |
# - name: Write GoogleService-Info.plist file for iOS | |
# uses: mobiledevops/secret-to-file-action@v1 | |
# with: | |
# base64-encoded-secret: ${{ secrets.GOOGLE_INFO_PLIST_IOS }} | |
# filename: "GoogleService-Info.plist" | |
# is-executable: false | |
# working-directory: "ios/Runner" | |
- name: Build APK | |
run: | | |
flutter build apk --release | |
cd build/app/outputs/apk/release | |
mv *.apk Medusa-Admin-${GITHUB_REF#refs/*/}.apk | |
- name: Build iPA | |
run: | | |
flutter build ios --release --no-codesign | |
cd build/ios/iphoneos | |
mkdir Payload | |
cd Payload | |
ln -s ../Runner.app | |
cd .. | |
zip -r Medusa-Admin-${GITHUB_REF#refs/*/}.ipa Payload | |
- name: Create Release | |
uses: ncipollo/release-action@v1.13.0 | |
with: | |
artifacts: "build/app/outputs/apk/release/*.apk,build/ios/iphoneos/*.ipa" | |
allowUpdates: true |