Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
guness committed Nov 10, 2019
2 parents 10cab75 + a0f973b commit 030afb8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
11 changes: 10 additions & 1 deletion bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ app:
- SAMPLE_APP_ANDROID: https://github.com/bitrise-io/sample-apps-android-sdk22.git
- SAMPLE_APP_IOS: https://github.com/bitrise-io/sample-apps-ios-simple-objc.git
- BITRISE_STEP_ID: firebase-app-distribution
- BITRISE_STEP_VERSION: 0.3.0
- BITRISE_STEP_VERSION: 0.4.0
- BITRISE_STEP_GIT_CLONE_URL: https://github.com/guness/bitrise-step-firebase-app-distribution.git
- MY_STEPLIB_REPO_FORK_GIT_URL: https://github.com/guness/bitrise-steplib.git
- FIREBASE_CI_TOKEN: $FIREBASE_CI_TOKEN
Expand Down Expand Up @@ -77,6 +77,7 @@ workflows:
- app: $FIREBASE_APP_ID_ANDROID
- app_path: $BITRISE_APK_PATH
- firebase_token: $FIREBASE_CI_TOKEN
- is_debug: "true"
deploy-ios:
steps:
- path::./:
Expand All @@ -86,6 +87,12 @@ workflows:
- app: $FIREBASE_APP_ID_IOS
- app_path: $BITRISE_IPA_PATH
- firebase_token: $FIREBASE_CI_TOKEN
- is_debug: "true"
deploy-bitrise:
steps:
- deploy-to-bitrise-io:
inputs:
- notify_user_groups: none
share-this-step:
description: |-
If this is the first time you try to share a Step you should
Expand Down Expand Up @@ -129,6 +136,8 @@ workflows:
- audit-this-step
- test-ios
- test-android
after_run:
- deploy-bitrise
test-ios:
before_run:
- build-ios
Expand Down
29 changes: 25 additions & 4 deletions step.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ function validate_required_input_with_options {
#
# Validate parameters
echo_info "Configs:"
echo_details "* firebase_token: ***"
echo_details "* firebase_token: $firebase_token"
echo_details "* service_credentials_file: $service_credentials_file"
echo_details "* app_path: $app_path"
echo_details "* app: $app"
echo_details "* release_notes: $release_notes"
echo_details "* testers: $testers"
echo_details "* groups: $groups"
echo_details "* flags: $flags"
echo_details "* is_debug: $is_debug"

echo

Expand All @@ -108,7 +110,7 @@ case "${app_path}" in
echo_fail "App path contains | . You need to choose one build path: ${app_path}"
;;
*)
echo_info "App path contains one file :+1:"
echo_info "App path contains one file 👍"
;;
esac

Expand All @@ -117,7 +119,15 @@ if [ ! -f "${app_path}" ] ; then
fi

if [ -z "${firebase_token}" ] ; then
echo_fail "Firebase Token is not defined"
if [ -z "${service_credentials_file}" ]; then
echo_fail "No authentication input was defined, please fill one of Firebase Token or Service Credentials Field."
elif [ ! -f "${service_credentials_file}" ]; then
echo_fail "Service Credentials File defined but does not exist at path: ${service_credentials_file}"
fi
fi

if [ -n "${firebase_token}" ] && [ -n "${service_credentials_file}" ]; then
echo_info "Both authentication inputs are defined: Firebase Token and Service Credentials Field, one is enough."
fi

if [ -z "${app}" ] ; then
Expand All @@ -128,7 +138,14 @@ fi
npm install -g firebase-tools

# Export Firebase Token
export FIREBASE_TOKEN="${firebase_token}"
if [ -n "${firebase_token}" ] ; then
export FIREBASE_TOKEN="${firebase_token}"
fi

# Export Service Credentials File
if [ -n "${service_credentials_file}" ] ; then
export GOOGLE_APPLICATION_CREDENTIALS="${service_credentials_file}"
fi

# Deploy
echo_info "Deploying build to Firebase"
Expand All @@ -153,6 +170,10 @@ if [ -n "${flags}" ] ; then
submit_cmd="$submit_cmd \"${flags}\""
fi

if [ "${is_debug}" = true ] ; then
submit_cmd="$submit_cmd --debug"
fi

echo_details "$submit_cmd"
echo
eval "$submit_cmd"
Expand Down
17 changes: 16 additions & 1 deletion step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,13 @@ inputs:
Firebase CI access token. You can create it by `firebase login:ci` on your local machine.
It is something in the form of `1/a1gqPSI3r-RLgCQO47pJW7WdmqdypiJMO`
is_required: true
is_sensitive: true
- service_credentials_file:
opts:
title: Service Credentials File
description: |
The path to your [service account](https://firebase.google.com/docs/app-distribution/android/distribute-gradle#authenticate_using_a_service_account) private key JSON file.
Required only if you use service account authentication.
- app_path: "$BITRISE_IPA_PATH|$BITRISE_APK_PATH"
opts:
title: App Path
Expand Down Expand Up @@ -101,3 +106,13 @@ inputs:
Additional flags to be appended to Firebase command.
ie. you can specify file inputs for groups, testers, and release notes.
is_required: false
- is_debug: "false"
opts:
category: Debug
title: "Enable Debug Mode"
summary: The step will print more verbose logs if enabled.
description: The step will print more verbose logs if enabled.
is_required: true
value_options:
- "false"
- "true"

0 comments on commit 030afb8

Please sign in to comment.