How can I use CodeMagic.io to automatically deploy my Flutter web application builds to firebase hosting?
Currently the only options that appear to be supported are Codemagic Static Pages and Amazon S3 Buckets. Unless a custom build script is used.
I have done some research on the custom build script option and there is not much information online pertaining to automatically deploying to firebase hosting. Although I suspect you may be able to modify provided example in the Codemagic distribution documentation ('Publishing an app using Firebase CLI' [https://docs.codemagic.io/publishing-yaml/distribution/]) to achieve this. See code extract below.
- name: Publish the app to Firebase App Distribution
script: |
apkPath=$(find build -name "*.apk" | head -1)
if [[ -z ${apkPath} ]]
then
echo "No apks were found, skip publishing to Firebase App Distribution"
else
echo "Publishing $apkPath to Firebase App Distribution"
firebase appdistribution:distribute --app <your_android_application_firebase_id> --groups <your_android_testers_group> $apkPath
fi
Does anyone know how I can write a custom script that achieves the desired outcome?
before deploy from CI/CD service ensure you completed following steps:
firebase init
firebase.json
to your repositoryThe next step is configuring CI/CD workflow
FIREBASE_TOKEN
to environment variables (check https://docs.codemagic.io/flutter/env-variables/ if you use Codemagic UI configuration)