Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/distribute_external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ jobs:
bundler-cache: true
working-directory: sample_app/android

- name: Setup Firebase Service Account'
- name: Distribute to S3
working-directory: sample_app/android
run: echo "${{ secrets.SAMPLE_FIREBASE_UPLOAD_CREDENTIALS }}" | base64 --decode | jq > ./firebase-service-account.json

- name: Distribute to Firebase
working-directory: sample_app/android
run: bundle exec fastlane distribute_to_firebase
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
run: bundle exec fastlane distribute_to_s3

ios:
needs: determine_platforms
Expand Down
6 changes: 6 additions & 0 deletions sample_app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ android {
signingConfig signingConfigs.debug
}
}

applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = "flutter-sample-app.apk"
}
}
}

flutter {
Expand Down
29 changes: 21 additions & 8 deletions sample_app/android/fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,33 @@ platform :android do
firebase_app_distribution(
app: app_id,
android_artifact_type: "APK",
android_artifact_path: "#{root_path}/build/app/outputs/flutter-apk/app-release.apk",
android_artifact_path: "#{root_path}/build/app/outputs/apk/release/flutter-sample-app.apk",
groups: "stream-testers, ios-stream-testers",
release_notes: "Lots of amazing new features to test out!",
service_credentials_file: "#{root_path}/android/firebase-service-account.json"
)
end

private_lane :appstore_api_key do
@appstore_api_key ||= app_store_connect_api_key(
key_id: 'MT3PRT8TB7',
issuer_id: '69a6de96-0738-47e3-e053-5b8c7c11a4d1',
key_content: ENV.fetch('APPSTORE_API_KEY', nil),
is_key_content_base64: true,
in_house: false,
desc "Build and distribute app to S3"
# Usage: bundle exec fastlane android distribute_to_s3
lane :distribute_to_s3 do |options|
build_apk

bucket_with_path = ENV.fetch("AWS_S3_BUCKET")
bucket_name, upload_path = bucket_with_path.chomp('/').split('/', 2)

# Validate that we have both bucket and path
UI.user_error!("AWS_S3_BUCKET must include path (e.g., 'bucket-name/downloads')") if upload_path.nil? || upload_path.empty?

aws_s3(
access_key: ENV.fetch("AWS_ACCESS_KEY_ID"),
secret_access_key: ENV.fetch("AWS_SECRET_ACCESS_KEY"),
region: ENV.fetch("AWS_REGION", "us-east-1"),
bucket: bucket_name,
path: upload_path,
acl: "private",
server_side_encryption: "AES256",
files: ["#{root_path}/build/app/outputs/apk/release/flutter-sample-app.apk"]
)
end
end
1 change: 1 addition & 0 deletions sample_app/android/fastlane/Pluginfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

gem 'fastlane-plugin-stream_actions'
gem 'fastlane-plugin-firebase_app_distribution'
gem 'fastlane-plugin-aws_s3'