Save 37% off PRO during our Black Friday Sale! »

Firebase App Distribution と Github Actions でapkを配布する

2f5ad50887405d93fc74a388e331fede?s=47 keijumt
December 12, 2019

Firebase App Distribution と Github Actions でapkを配布する

2f5ad50887405d93fc74a388e331fede?s=128

keijumt

December 12, 2019
Tweet

Transcript

  1. © DMM.com Firebase App Distribution + Github Actions ͰapkΛ഑෍͢Δ @keijumt

    DMM Androidษڧձ
  2. © DMM.com • keijumt / দຊܓथ(͚͍͡Ύ) • CTOࣨ ΤόϯδΣϦετνʔϜॴଐ •

    εϊʔϘʔυ͕޷͖ • ࠷ۙiOS։ൃͯ͠·͢ ࣗݾ঺հ 2
  3. © DMM.com ΞδΣϯμ • Firebase App Distributionͱ͸ʁ • App Distribution

    Gradle Pluginͷಋೖ • Github Actionsͱ͸ʁ • Github Actionsͷಋೖ • ςελʔʹ഑෍
  4. © DMM.com Firebase App Distributionͱ͸ʁ

  5. © DMM.com Firebase App Distributionͱ͸ʁ • Firebaseͷػೳͷ̍ͭ • ΞϓϦͷϕʔλ൛Λ഑৴ •

    ςελʔ༻ͷωΠςΟϒΞϓϦ͕͋Δ
  6. © DMM.com Fabric͔ΒͷҠߦઌ

  7. © DMM.com ഑෍ํ๏ • Firebase Console • Firebase CLI •

    fastlane • App Distribution Gradle Plugin
  8. © DMM.com ഑෍ํ๏ • Firebase Console • Firebase CLI •

    fastlane • App Distribution Gradle Plugin
  9. © DMM.com App Distribution Gradle Pluginͷར༻ʹ͋ͨͬͯ • લఏ৚݅ • FirebaseϓϩδΣΫτ͕࡞੒͞Ε͍ͯΔ

    • ΞϓϦ͕FirebaseϓϩδΣΫτʹඥ෇͍͍ͯΔ • ൿಗ৘ใܥͷ؅ཧ͸είʔϓ֎
  10. © DMM.com App Distribution Gradle Plugin ͷಋೖ

  11. © DMM.com App Distribution Gradle Pluginͷར༻खॱ 1. αʔϏεΞΧ΢ϯτͷ࡞੒ 2. App

    Distribution APIͷ༗ޮԽ 3. App Distribution Gradle Pluginͷಋೖ 4. gradleʹ഑෍ઃఆͷهड़
  12. © DMM.com App Distribution Gradle Pluginͷར༻खॱ 1. αʔϏεΞΧ΢ϯτͷ࡞੒ 2. App

    Distribution APIͷ༗ޮԽ 3. App Distribution Gradle Pluginͷಋೖ 4. gradleʹ഑෍ઃఆͷهड़
  13. © DMM.com αʔϏεΞΧ΢ϯτͷ࡞੒

  14. © DMM.com App Distribution Gradle Pluginͷར༻खॱ 1. αʔϏεΞΧ΢ϯτͷ࡞੒ 2. App

    Distribution APIͷ༗ޮԽ 3. App Distribution Gradle Pluginͷಋೖ 4. gradleʹ഑෍ઃఆͷهड़
  15. © DMM.com App Distribution APIͷ༗ޮԽ • Google APIs Console͔Β Firebase

    App Distribution API Λ༗ޮԽ • 2019೥9݄20೔Ҏ߱ʹ࡞੒͞ΕͨϓϩδΣΫτ͸σϑΥϧτͰ༗ޮ ʹͳ͍ͬͯΔ
  16. © DMM.com App Distribution Gradle Pluginͷར༻खॱ 1. αʔϏεΞΧ΢ϯτͷ࡞੒ 2. App

    Distribution APIͷ༗ޮԽ 3. App Distribution Gradle Pluginͷಋೖ 4. gradleʹ഑෍ઃఆͷهड़
  17. © DMM.com build.gradle(project) buildscript { repositories { google() } dependencies

    { classpath ‘com.google.firebase:firebase-appdistribution-gradle:1.3.0' } }
  18. © DMM.com build.gradle(app) apply plugin: 'com.google.firebase.appdistribution'

  19. © DMM.com App Distribution Gradle Pluginͷར༻खॱ 1. αʔϏεΞΧ΢ϯτͷ࡞੒ 2. App

    Distribution APIͷ༗ޮԽ 3. App Distribution Gradle Pluginͷಋೖ 4. gradleʹ഑෍ઃఆͷهड़
  20. © DMM.com App Distribution Gradle PluginͷΦϓγϣϯ • appId(required) • serviceCredentialsFile

    • releaseNotes or releaseNotesFile • testers or testersFile • groups or groupsFile
  21. © DMM.com App Distribution Gradle PluginͷΦϓγϣϯ • appId(required) • serviceCredentialsFile

    • releaseNotes or releaseNotesFile • testers or testersFile • groups or groupsFile
  22. © DMM.com App Distribution Gradle PluginͷΦϓγϣϯ • appId(required) • serviceCredentialsFile

    • releaseNotes or releaseNotesFile • testers or testersFile • groups or groupsFile
  23. © DMM.com App Distribution Gradle PluginͷΦϓγϣϯ • appId(required) • serviceCredentialsFile

    • releaseNotes or releaseNotesFile • testers or testersFile • groups or groupsFile releaseNotes = “this is a release note” releaseNotesFile = “/path/to/releaseNote.txt
  24. © DMM.com App Distribution Gradle PluginͷΦϓγϣϯ • appId(required) • serviceCredentialsFile

    • releaseNotes or releaseNotesFile • testers or testersFile • groups or groupsFile testers="ali@example.com, bri@example.com” testersFile="/path/to/testers.txt"
  25. © DMM.com App Distribution Gradle PluginͷΦϓγϣϯ • appId(required) • serviceCredentialsFile

    • releaseNotes or releaseNotesFile • testers or testersFile • groups or groupsFile groups="qa-team, android-testers" groupsFile="/path/to/tester-groups.txt"
  26. © DMM.com build.gradle(app) buildTypes { release { signingConfig signingConfigs.release firebaseAppDistribution

    { appId = "appId" serviceCredentialsFile = "${rootDir.absolutePath}/firebase-admin-sdk.json" } } }
  27. © DMM.com apkͷΞοϓϩʔυ • assembleBUILD-VARIANT • appDistributionUploadBUILD-VARIANT

  28. © DMM.com Github Actions

  29. © DMM.com Github Actionsͱ͸ʁ • GithubͰར༻Ͱ͖ΔCI • YAMLͰهड़ • AndroidΛϏϧυग़དྷΔ؀ڥ͕༻ҙ͞Ε͍ͯΔ

  30. © DMM.com YAMLߏจʹ͍ͭͯ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease
  31. © DMM.com YAMLߏจʹ͍ͭͯ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease
  32. © DMM.com YAMLߏจʹ͍ͭͯ on: pull_request: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease
  33. © DMM.com YAMLߏจʹ͍ͭͯ on: pull_request: branches: - 'releases/**' jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease
  34. © DMM.com YAMLߏจʹ͍ͭͯ on: pull_request: branches: - 'releases/**' tags: -

    v1.* jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease
  35. © DMM.com YAMLߏจʹ͍ͭͯ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease
  36. © DMM.com YAMLߏจʹ͍ͭͯ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease
  37. © DMM.com YAMLߏจʹ͍ͭͯ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease • Windows Server 2016 • Windows Server 2019 • Ubuntu 18.04 • Ubuntu 16.04 • macOS Catalina 10.15
  38. © DMM.com YAMLߏจʹ͍ͭͯ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease • Android SDK: 15 ~ 29 • build-tools: 24.0.0 ~ 29.0.2
  39. © DMM.com YAMLߏจʹ͍ͭͯ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease
  40. © DMM.com YAMLߏจʹ͍ͭͯ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease {owner}/{repo}@{ref} • actions/setup-node@74bc508 • actions/setup-node@v1 • actions/setup-node@v1.2 • actions/setup-node@master
  41. © DMM.com YAMLߏจʹ͍ͭͯ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease
  42. © DMM.com YAMLߏจʹ͍ͭͯ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Apk run: ./gradlew assenbleRelease - name: Echo environment variable run: echo ${{ secrets.HOGE }}
  43. © DMM.com Github Actionsͷಋೖ

  44. © DMM.com Github Actionsͷಋೖ • YAMLͰworkflowΛهड़ • project/.github/workflowsʹYAMLΛ഑ஔ

  45. © DMM.com workflowͷྲྀΕ • master΁ͷpushΛτϦΨʔʹ͢Δ • ϦϦʔεϏϧυͰapkΛ࡞੒ • App Distribution

    Gradle PluginͰapkΛΞοϓϩʔυ
  46. © DMM.com YAMLͷهड़ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Release APK run: ./gradlew assembleRelease - name: Deploy app distribution run: ./gradlew appDistributionUploadRelease
  47. © DMM.com YAMLͷهड़ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Release APK run: ./gradlew assembleRelease - name: Deploy app distribution run: ./gradlew appDistributionUploadRelease
  48. © DMM.com YAMLͷهड़ on: push: branches: - master jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - name: Build Release APK run: ./gradlew assembleRelease - name: Deploy app distribution run: ./gradlew appDistributionUploadRelease
  49. © DMM.com CI͕࣮ߦ͞ΕΔ

  50. © DMM.com App Distributionʹapk͕Ξοϓϩʔυ͞ΕΔ

  51. © DMM.com ςελʔʹ഑෍

  52. © DMM.com ςελʔʹ഑෍ • Console͔Β഑෍͍ͨ͠όʔδϣϯʹςελʔΛ௥Ճ • build.gradleʹςελʔͷϝʔϧΞυϨεΛࢦఆ • build.gradleʹςελʔάϧʔϓΛࢦఆ

  53. © DMM.com ςελʔʹ഑෍ • Console͔Β഑෍͍ͨ͠όʔδϣϯʹςελʔΛ௥Ճ • build.gradleʹςελʔͷϝʔϧΞυϨεΛࢦఆ • build.gradleʹςελʔάϧʔϓΛࢦఆ

  54. © DMM.com ConsoleͰςελʔΛ௥Ճ

  55. © DMM.com ςελʔ͕ೝূ

  56. © DMM.com ςελʔ͕ೝূ

  57. © DMM.com App Tester

  58. © DMM.com ͓ΘΓʹ

  59. © DMM.com ͓ΘΓʹ • App Distribution Gradle PluginͰFabric͔ΒͷҠߦָ͕ͦ͏ • Github

    Actionsͷಋೖ͕؆୯ • Firebaseެࣜϖʔδͷ೔ຊޠରԠ͕஗͍
  60. © DMM.com ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ