Skip to content

Instantly share code, notes, and snippets.

@KazaKago
Last active February 8, 2019 01:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KazaKago/7d91f3740345889e9812e6aecd9d98a4 to your computer and use it in GitHub Desktop.
Save KazaKago/7d91f3740345889e9812e6aecd9d98a4 to your computer and use it in GitHub Desktop.
bitrise.yml example
---
format_version: '4'
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
project_type: android
workflows:
unittest_staging:
before_run: []
after_run:
- _unittest
- _danger
envs:
- MODULE_NAME: app
- VARIANT_NAME: StagingRelease
unittest_production:
before_run: []
after_run:
- _unittest
- _danger
envs:
- MODULE_NAME: app
- VARIANT_NAME: ProductionRelease
deploy_staging:
before_run: []
after_run:
- _deploy
- _slack
envs:
- MODULE_NAME: app
- VARIANT_NAME: StagingRelease
- SLACK_DESCRIPTION: Deployed $BITRISE_APP_TITLE to `DeployGate`!
- SLACK_DESCRIPTION_IF_BUILD_FAILED: Failed to deploy $BITRISE_APP_TITLE to `DeployGate`!
- BITRISE_PUBLIC_INSTALL_PAGE_URL: https://deploygate.com/users/kazakago/platforms/android/apps/com.kazakago.cleanarchitecture.staging
deploy_production:
before_run: []
after_run:
- _deploy
- _slack
envs:
- MODULE_NAME: app
- VARIANT_NAME: ProductionRelease
- SLACK_DESCRIPTION: Deployed $BITRISE_APP_TITLE to `DeployGate`!
- SLACK_DESCRIPTION_IF_BUILD_FAILED: Failed to deploy $BITRISE_APP_TITLE to `DeployGate`!
- BITRISE_PUBLIC_INSTALL_PAGE_URL: https://deploygate.com/users/kazakago/platforms/android/apps/com.kazakago.cleanarchitecture
uploadstore:
before_run: []
after_run:
- _uploadstore
- _slack
envs:
- SERVICE_ACCOUNT_JSON_KEY_FILE_PATH: "$BITRISEIO_SERVICE_ACCOUNT_JSON_KEY_FILE_URL"
- MODULE_NAME: app
- VARIANT_NAME: ProductionRelease
- SLACK_DESCRIPTION: Uploaded $BITRISE_APP_TITLE to `Google Play Console`!
- SLACK_DESCRIPTION_IF_BUILD_FAILED: Failed to upload $BITRISE_APP_TITLE to `Google
Play Console`!
- BITRISE_PUBLIC_INSTALL_PAGE_URL: https://play.google.com/store/apps/details?id=com.kazakago.cleanarchitecture
_setup:
steps:
- activate-ssh-key@4.0.3:
run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
- git-clone@4.0.14: {}
- install-missing-android-tools@2.3.4: {}
_unittest:
steps:
- android-unit-test@0.9.5:
inputs:
- variant: "$VARIANT_NAME"
- module: "$MODULE_NAME"
before_run:
- _setup
description: |-
## Env Vars
- `$MODULE_NAME`
- `$VARIANT_NAME`
_build:
steps:
- android-build@0.9.5:
inputs:
- variant: "$VARIANT_NAME"
- module: "$MODULE_NAME"
- apk-info@1.4.2: {}
- sign-apk@1.2.4: {}
before_run:
- _setup
description: |-
## Env Vars
- `$MODULE_NAME`
- `$VARIANT_NAME`
_deploy:
before_run:
- _build
description: |-
## Secrets
- `$DEPLOY_GATE_USER_NAME`
- `$DEPLOY_GATE_API_KEY`
steps:
- deploygate--upload-app-bitrise-step@1.0.1:
inputs:
- owner_name: "$DEPLOY_GATE_USER_NAME"
- app_path: "$BITRISE_SIGNED_APK_PATH"
- api_key: "$DEPLOY_GATE_API_KEY"
_uploadstore:
steps:
- google-play-deploy@1.5.1:
inputs:
- apk_path: "$BITRISE_SIGNED_APK_PATH"
- user_fraction: '0.2'
- track: beta
- package_name: "$ANDROID_APP_PACKAGE_NAME"
- service_account_json_key_path: "$SERVICE_ACCOUNT_JSON_KEY_FILE_PATH"
before_run:
- _build
description: |-
## Env Vars
- `$SERVICE_ACCOUNT_JSON_KEY_FILE_PATH`
_danger:
steps:
- script@1.1.5:
inputs:
- content: |-
#!/bin/bash
# fail if any commands fails
set -e
# debug log
set -x
# write your script here
bundle install
bundle exec danger
# or run a script from your repository, like:
# bash ./path/to/script.sh
# not just bash, e.g.:
# ruby ./path/to/script.rb
title: Danger
description: |-
## Secrets
- `$DANGER_GITHUB_API_TOKEN`
_slack:
before_run: []
steps:
- slack@3.1.2:
inputs:
- webhook_url: "$SLACK_WEBHOOK_URL"
- message: "$SLACK_DESCRIPTION"
- fields: |-
App|${BITRISE_APP_TITLE}
Branch|${BITRISE_GIT_BRANCH}
Workflow|${BITRISE_TRIGGERED_WORKFLOW_ID}
Version|${ANDROID_APP_VERSION_NAME}
- message_on_error: "$SLACK_DESCRIPTION_IF_BUILD_FAILED"
description: |-
## Secrets
- `$SLACK_WEBHOOK_URL`
## Env Vars
- `$SLACK_DESCRIPTION`
- `$SLACK_DESCRIPTION_IF_BUILD_FAILED`
trigger_map:
- push_branch: develop
workflow: deploy_staging
- push_branch: release/*
workflow: deploy_production
- push_branch: hotfix/*
workflow: deploy_production
- pull_request_source_branch: feature/*
pull_request_target_branch: develop
workflow: unittest_staging
- pull_request_source_branch: release/*
pull_request_target_branch: master
workflow: unittest_production
- pull_request_source_branch: release/*
pull_request_target_branch: develop
workflow: unittest_production
- pull_request_source_branch: hotfix/*
pull_request_target_branch: master
workflow: unittest_production
- pull_request_source_branch: hotfix/*
pull_request_target_branch: develop
workflow: unittest_production
- pull_request_source_branch: "*"
workflow: unittest_staging
- tag: "*.*.*"
workflow: uploadstore
app:
envs:
- GRADLEW_PATH: "./gradlew"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment