diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b0d11ad07..a01309f1b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,9 @@ name: Build on: + push: + branches: + - main workflow_dispatch: inputs: version-name: @@ -11,6 +14,11 @@ on: description: "Optional. Build number to use. Overrides default of GitHub run number." required: false type: number + distribute-to-firebase: + description: "Optional. Distribute artifacts to Firebase." + required: false + default: false + type: boolean publish-to-play-store: description: "Optional. Deploy bundle artifact to Google Play Store" required: false @@ -120,6 +128,7 @@ jobs: --name authenticator_aab-keystore.jks --file ${{ github.workspace }}/keystores/authenticator_aab-keystore.jks --output none - name: Download Firebase credentials + if : ${{ inputs.distribute-to-firebase || github.event_name == 'push' }} env: ACCOUNT_NAME: bitwardenci CONTAINER_NAME: mobile @@ -230,19 +239,11 @@ jobs: if-no-files-found: error - name: Install Firebase app distribution plugin - if: ${{ github.ref_name == 'main' }} + if: ${{ inputs.distribute-to-firebase || github.event_name == 'push' }} run: bundle exec fastlane add_plugin firebase_app_distribution - - name: Publish release artifacts to Firebase - if: ${{ github.ref_name == 'main' && matrix.variant == 'apk' }} - env: - FIREBASE_CREDS_PATH: ${{ github.workspace }}/secrets/authenticator_play_firebase-creds.json - run: | - bundle exec fastlane distributeReleaseToFirebase \ - serviceCredentialsFile:${{ env.FIREBASE_CREDS_PATH }} - - name: Publish release bundle to Firebase - if: ${{ github.ref_name == 'main' && matrix.variant == 'aab' }} + if: ${{ matrix.variant == 'aab' && (inputs.distribute-to-firebase || github.event_name == 'push' }} env: FIREBASE_CREDS_PATH: ${{ github.workspace }}/secrets/authenticator_play_firebase-creds.json run: | diff --git a/fastlane/Fastfile b/fastlane/Fastfile index d4c09c375..36c93531a 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -94,8 +94,8 @@ platform :android do ) end - desc "Publish release to Firebase" - lane :distributeReleaseToFirebase do |options| + desc "Publish release AAB to Firebase" + lane :distributeReleaseBundleToFirebase do |options| release_notes = changelog_from_git_commits( commits_count: 1, pretty: "- %s" @@ -105,33 +105,14 @@ platform :android do firebase_app_distribution( app: "1:867301491091:android:50b626dba42a361651e866", - android_artifact_type: "APK", - android_artifact_path: "app/build/outputs/apk/release/com.bitwarden.authenticator-release.apk", + android_artifact_type: "AAB", + android_artifact_path: "app/build/outputs/bundle/release/com.bitwarden.authenticator-release.aab", service_credentials_file: options[:serviceCredentialsFile], groups: "internal-prod-group", release_notes: release_notes, ) end - desc "Publish release AAB to Firebase" - lane :distributeReleaseBundleToFirebase do |options| - release_notes = changelog_from_git_commits( - commits_count: 1, - pretty: "- %s" - ) - - puts "Release notes #{release_notes}" - - firebase_app_distribution( - app: "1:867301491091:android:50b626dba42a361651e866", - android_artifact_type: "AAB", - android_artifact_path: "app/build/outputs/bundle/release/com.bitwarden.authenticator-release.aab", - service_credentials_file: options[:serviceCredentialsFile], - groups: "internal-prod-group", - release_notes: release_notes, - ) - end - desc "Publish release to Google Play Store" lane :publishReleaseToGooglePlayStore do |options| upload_to_play_store(