Skip to content

Instantly share code, notes, and snippets.

@devmsh
Last active July 11, 2020 08:12
Show Gist options
  • Save devmsh/857f9d0eafcab9bdf6795220d5b5b0cb to your computer and use it in GitHub Desktop.
Save devmsh/857f9d0eafcab9bdf6795220d5b5b0cb to your computer and use it in GitHub Desktop.
Build and distribute flutter app to Firebase App Distribution
echo "Building flutter Android release"
flutter build apk --release -t lib/main_staging.dart --flavor staging
echo "Distribut Android release"
firebase appdistribution:distribute \
./build/app/outputs/flutter-apk/app-staging-release.apk \
--app 1:612834649949:android:b8f54d1cdb7c3f611caab4 \
--release-notes-file ./release_notes.txt \
--groups="internal-testers"
echo "Building flutter iOS release"
flutter build ios \
--release \
--no-codesign \
-t lib/main_staging.dart \
--flavor staging
echo "Archive iOS release"
xcodebuild -workspace ./ios/Runner.xcworkspace \
-scheme Runner \
-archivePath ./build/ios/custom/build.xcarchive \
-config Release \
archive \
COMPILER_INDEX_STORE_ENABLE=NO \
DEVELOPMENT_TEAM=ELCYM5HP8Z \
CODE_SIGN_IDENTITY='iPhone Developer' \
-quiet
echo "Export iOS ipa file"
xcodebuild -exportArchive \
-archivePath ./build/ios/custom/build.xcarchive \
-exportPath ./build/ios/custom/archive/ \
-exportOptionsPlist ./tools/ExportOptions.plist \
COMPILER_INDEX_STORE_ENABLE=NO \
-quiet
echo "Distribut iOS release"
firebase appdistribution:distribute \
./build/ios/custom/archive/Runner.ipa \
--app 1:612834649949:ios:9cbf7288f8be4c831caab4 \
--release-notes-file ./release_notes.txt \
--groups="internal-testers"
#!/bin/bash
set -e
echo "Find and increment the version number"
perl -i -pe 's/^(version:\s+\d+\.\d+\.\d+\+)(\d+)$/$1.($2+1)/e' ./pubspec.yaml
echo "Commit and tag this change"
version=`grep 'version: ' ./pubspec.yaml | sed 's/version: //'`
echo "Generate release notes"
echo "Release notes for version $version" >> release_notes.txt
git-changelog generate --previous-commit `git rev-list --tags --skip=0 --max-count=1` >> release_notes.txt
echo "---\n" >> release_notes.txt
git add ./pubspec.yaml
git add ./release_notes.txt
git commit -m "Bump version to $version"
git tag $version
sh ./tools/distribute-android-staging.sh
sh ./tools/distribute-ios-staging.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment