Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Tips for Bitrise Android

Tips for Bitrise Android

Bitrise is a mobile-development-focused CI/DI PaaS.

In this talk, I shared some tips and things that I found while integrating Bitrise to Tapple for Android project. In this talk I also shared some of the benefits we gained by using fastlane actions as well.

* Bitrise DevCenter - What is Bitrise? - Bitrise DevCenter
https://devcenter.bitrise.io/

* Android code signing in Gradle - Bitrise DevCenter
https://devcenter.bitrise.io/code-signing/android-code-signing/android-code-signing-in-gradle/

* Actions - fastlane docs
https://docs.fastlane.tools/actions/

* How to cache Gradle dependencies - How To - Bitrise Discussions
https://discuss.bitrise.io/t/how-to-cache-gradle-dependencies/194

Shohei Kawano

June 21, 2018
Tweet

More Decks by Shohei Kawano

Other Decks in Technology

Transcript

  1. •How to setup Bitrise / Bitrise Steps •How to setup

    Fastlane •How to Manage bitrise.yml on Git Not Talking
  2. ?

  3. •Push Commit→ Run Test → Lint → Distribute App through

    Crashlytics
 •Push Tag(GitHub Draft Release) → 
 Build ReleaseAPK → Upload APK Before
  4. •Memory Shortage → Build Failure •Home-made shell script •For Slack

    notification •For code signing •For uploading APK to GitHub Release Problem
  5. •Memory Shortage → Build Failure 
 •Home-made shell script •

    For Slack notification • For code signing • For uploading APK to GitHub Release
  6. •Memory Shortage → ✅ NO MORE
 •Home-made shell script •

    For Slack notification • For code signing • For uploading APK to GitHub Release
  7. •Memory Shortage → ✅ NO MORE
 •Home-made shell script •

    For Slack notification • For code signing • For uploading APK to GitHub Release
  8. bitrise.yml(on bitrise.io) trigger_map: - push_branch: "*" workflow: primary - pull_request_source_branch:

    "*" workflow: primary workflows: primary: steps: - [email protected]: {} - [email protected]: {} - [email protected]: inputs: - content: |- #!/bin/bash bitrise trigger "$BITRISE_GIT_BRANCH"
  9. bitrise.yml(on bitrise.io) trigger_map: - tag: "*" workflow: primary - push_branch:

    "*" workflow: primary - pull_request_source_branch: "*" workflow: primary workflows: primary: steps: - [email protected]: {} - [email protected]: {} - [email protected]: inputs: - content: |- #!/bin/bash bitrise trigger "$BITRISE_GIT_BRANCH"
  10. bitrise.yml(on bitrise.io) trigger_map: - tag: "*" workflow: primary - push_branch:

    "*" workflow: primary - pull_request_source_branch: "*" workflow: primary workflows: primary: steps: - [email protected]: {} - [email protected]: {} - [email protected]: inputs: - content: |- #!/bin/bash bitrise trigger "$BITRISE_GIT_BRANCH"
  11. bitrise.yml(on bitrise.io) trigger_map: - tag: "*" workflow: primary - push_branch:

    "*" workflow: primary - pull_request_source_branch: "*" workflow: primary workflows: primary: steps: - [email protected]: {} - [email protected]: {} - [email protected]: inputs: - content: |- #!/bin/bash bitrise trigger "$BITRISE_GIT_BRANCH"
  12. bitrise.yml(in repository) trigger_map: - tag: "*" workflow: draftRelease - push_branch:

    master workflow: beta - push_branch: "*" workflow: test - pull_request_target_branch: "*" workflow: danger workflows: beta: title: Distribute new StagingRelease APK as beta before_run: - _prepare steps: - [email protected]: inputs: - content: |- bundle exec fastlane beta
  13. bitrise.yml(in repository) trigger_map: - tag: "*" workflow: draftRelease - push_branch:

    master workflow: beta - push_branch: "*" workflow: test - pull_request_target_branch: "*" workflow: danger workflows: beta: title: Distribute new StagingRelease APK as beta before_run: - _prepare steps: - [email protected]: inputs: - content: |- bundle exec fastlane beta ←EXPECT TO TRIGGER
  14. bitrise.yml(in repository) trigger_map: - tag: "*" workflow: draftRelease - push_branch:

    master workflow: beta - push_branch: "*" workflow: test - pull_request_target_branch: "*" workflow: danger workflows: beta: title: Distribute new StagingRelease APK as beta before_run: - _prepare steps: - [email protected]: inputs: - content: |- bundle exec fastlane beta ←ACTUALLY TRIGGERS
  15. bitrise.yml(on bitrise.io) trigger_map: - tag: "*" workflow: primary - push_branch:

    "*" workflow: primary - pull_request_source_branch: "*" workflow: primary workflows: primary: steps: - [email protected]: {} - [email protected]: {} - [email protected]: inputs: - content: |- #!/bin/bash bitrise trigger "$BITRISE_GIT_BRANCH"
  16. bitrise.yml(on bitrise.io) trigger_map: - tag: "*" workflow: primary - push_branch:

    "*" workflow: primary - pull_request_source_branch: "*" workflow: primary workflows: primary: steps: - [email protected]: {} - [email protected]: {} - [email protected]: inputs: - content: |- #!/bin/bash bitrise trigger "$BITRISE_GIT_BRANCH"
  17. bitrise.yml(on bitrise.io) trigger_map: - tag: "*" workflow: primary - push_branch:

    "*" workflow: primary - pull_request_source_branch: "*" workflow: primary workflows: primary: steps: - [email protected]: {} - [email protected]: {} - [email protected]: inputs: - content: |- #!/bin/bash bitrise trigger "$BITRISE_GIT_BRANCH"
  18. bitrise.yml(on bitrise.io) trigger_map: - tag: "*" workflow: primary - push_branch:

    "*" workflow: primary - pull_request_source_branch: "*" workflow: primary workflows: primary: steps: - [email protected]: {} - [email protected]: {} - [email protected]: inputs: - content: |- #!/bin/bash bitrise trigger —-tag "$BITRISE_GIT_TAG"
  19. e.g. When new tag is pushed, 
 1. Draft new

    release on GitHub
 2. Build releasing-application 3. Upload signed APK to the release
  20. bitrise.yml(in repository) draftRelease: title: Add new draft release on GitHub

    before_run: - _prepare steps: - file-downloader: inputs: - source: "$BITRISEIO_ANDROID_KEYSTORE_URL" - destination: "$BITRISE_SOURCE_DIR/tapple-android.keystore" - file-downloader: inputs: - source: "$BITRISEIO_TAPPLE_ANDROID_GRADLE_URL" - destination: "$BITRISE_SOURCE_DIR/tapple-android.gradle" - [email protected]: inputs: - content: |- bundle exec fastlane draftRelease
  21. bitrise.yml(in repository) draftRelease: title: Add new draft release on GitHub

    before_run: - _prepare steps: - file-downloader: inputs: - source: "$BITRISEIO_ANDROID_KEYSTORE_URL" - destination: "$BITRISE_SOURCE_DIR/tapple-android.keystore" - file-downloader: inputs: - source: "$BITRISEIO_TAPPLE_ANDROID_GRADLE_URL" - destination: "$BITRISE_SOURCE_DIR/tapple-android.gradle" - [email protected]: inputs: - content: |- bundle exec fastlane draftRelease
  22. bitrise.yml(in repository) draftRelease: title: Add new draft release on GitHub

    before_run: - _prepare steps: - file-downloader: inputs: - source: "$BITRISEIO_ANDROID_KEYSTORE_URL" - destination: "$BITRISE_SOURCE_DIR/tapple-android.keystore" - file-downloader: inputs: - source: "$BITRISEIO_TAPPLE_ANDROID_GRADLE_URL" - destination: "$BITRISE_SOURCE_DIR/tapple-android.gradle" - [email protected]: inputs: - content: |- bundle exec fastlane draftRelease
  23. Fastfile desc "Add Draft Release to GitHub" lane :draftRelease do

    gradle(task: 'assembleProductionRelease') set_github_release( repository_name: “xxxx", is_draft: true, api_token: ENV['GITHUB_API_TOKEN'], name: ENV['BITRISE_GIT_TAG'], tag_name: ENV[‘BITRISE_GIT_TAG'], description: commits_log, upload_assets: lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS] ) slack(message: “New Draft Release! :)”) end
  24. Fastfile desc "Add Draft Release to GitHub" lane :draftRelease do

    gradle(task: 'assembleProductionRelease') set_github_release( repository_name: “xxxx", is_draft: true, api_token: ENV['GITHUB_API_TOKEN'], name: ENV['BITRISE_GIT_TAG'], tag_name: ENV[‘BITRISE_GIT_TAG'], description: commits_log, upload_assets: lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS] ) slack(message: “New Draft Release! :)”) end
  25. Fastfile desc "Add Draft Release to GitHub" lane :draftRelease do

    gradle(task: 'assembleProductionRelease') set_github_release( repository_name: “xxxx", is_draft: true, api_token: ENV['GITHUB_API_TOKEN'], name: ENV['BITRISE_GIT_TAG'], tag_name: ENV[‘BITRISE_GIT_TAG'], description: commits_log, upload_assets: lane_context[SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS] ) slack(message: “New Draft Release! :)”) end