From d517159fdbd42f99bca1e30862c8bfd7cd79e6a5 Mon Sep 17 00:00:00 2001 From: Anton Stubenbord Date: Sat, 10 Jun 2023 16:46:30 +0200 Subject: [PATCH] feat: Update github action and fastlane configuration --- .../workflows/release-deploy-play-store.yml | 18 ++--- android/fastlane/Fastfile | 72 ++++--------------- 2 files changed, 19 insertions(+), 71 deletions(-) diff --git a/.github/workflows/release-deploy-play-store.yml b/.github/workflows/release-deploy-play-store.yml index af2e30a..dd3bc72 100644 --- a/.github/workflows/release-deploy-play-store.yml +++ b/.github/workflows/release-deploy-play-store.yml @@ -5,21 +5,18 @@ on: # Enable manual run workflow_dispatch: inputs: - lane: - description: "Fastlane lane" - required: true - default: "alpha" + track: + description: "Track" type: choice - options: + default: beta + options: - internal - - promote_to_alpha - alpha - - promote_to_beta - beta - - promote_to_production - production + is_draft: - description: "Only create a draft and don't automatically publish?" + description: "Mark as draft" required: true default: true type: boolean @@ -64,8 +61,7 @@ jobs: working-directory: android # Build and deploy with Fastlane - # Naturally, promote_to_{alpha|beta|production} only deploys. - - run: bundle exec fastlane ${{ github.event.inputs.lane }} is_draft:${{ github.event.inputs.is_draft }} + - run: bundle exec fastlane publish_in_play_store is_draft:${{ github.event.inputs.is_draft }} track:${{ github.event.inputs.track }} env: PLAY_STORE_CREDENTIALS: ${{ secrets.PLAY_STORE_CREDENTIALS }} working-directory: android diff --git a/android/fastlane/Fastfile b/android/fastlane/Fastfile index d3d0adc..b0774e0 100644 --- a/android/fastlane/Fastfile +++ b/android/fastlane/Fastfile @@ -21,78 +21,30 @@ platform :android do |options| gradle(task: "test") end - desc "Submit a new internal build to Google Play" - lane :internal do |options| + desc "Submit build to Google Play" + lane :publish_in_play_store do |options| + release_status = (options[:is_draft] ? "draft" : "completed") + track = (options[:track]) sh "flutter build appbundle -v" upload_to_play_store( - track: 'internal', + track: track, + release_status: release_status, aab: '../build/app/outputs/bundle/release/app-release.aab', json_key_data: ENV['PLAY_STORE_CREDENTIALS'], - release_status: options[:is_draft] ? "draft" : "completed", ) end - - desc "Promote internal track to alpha" - lane :promote_to_alpha do |options| + desc "Promote track" + lane :play_store_promote do |options| + track = options[:track] + promote_to = options[:promote_to_track] upload_to_play_store( - track: 'internal', - track_promote_to: 'alpha', + track: track, + track_promote_to: promote_to, json_key_data: ENV['PLAY_STORE_CREDENTIALS'], ) end - desc "Submit a new alpha build to Google Play" - lane :alpha do |options| - sh "flutter build appbundle -v" - upload_to_play_store( - track: 'alpha', - aab: '../build/app/outputs/bundle/release/app-release.aab', - json_key_data: ENV['PLAY_STORE_CREDENTIALS'], - release_status: options[:is_draft] ? "draft" : "completed", - ) - end - - desc "Promote alpha track to beta" - lane :promote_to_beta do |options| - upload_to_play_store( - track: 'alpha', - track_promote_to: 'beta', - json_key_data: ENV['PLAY_STORE_CREDENTIALS'], - ) - end - - desc "Submit a new beta build to Google Play" - lane :beta do |options| - sh "flutter build appbundle -v" - upload_to_play_store( - track: 'beta', - aab: '../build/app/outputs/bundle/release/app-release.aab', - json_key_data: ENV['PLAY_STORE_CREDENTIALS'], - release_status: options[:is_draft] ? "draft" : "completed", - ) - end - - desc "Promote beta track to prod" - lane :promote_to_production do |options| - upload_to_play_store( - track: 'beta', - track_promote_to: 'production', - json_key_data: ENV['PLAY_STORE_CREDENTIALS'], - ) - end - - desc "Submit a new production build to Google Play" - lane :production do |options| - sh "flutter build appbundle -v" - upload_to_play_store( - track: 'production', - aab: '../build/app/outputs/bundle/release/app-release.aab', - json_key_data: ENV['PLAY_STORE_CREDENTIALS'], - release_status: options[:is_draft] ? "draft" : "completed", - ) - end - desc "Builds apks and creates a new release on GitHub" lane :github do |options| sh "flutter build apk --split-per-abi --release"