main.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. name: Android CI
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. jobs:
  8. build:
  9. runs-on: ubuntu-latest
  10. env:
  11. SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
  12. steps:
  13. - uses: actions/checkout@v2
  14. - name: set up JDK 1.8
  15. uses: actions/setup-java@v2
  16. with:
  17. java-version: 1.8
  18. distribution: 'adopt'
  19. - name: Install NDK
  20. run: echo "y" | sudo /usr/local/lib/android/sdk/tools/bin/sdkmanager --install "ndk;21.0.6113669" --sdk_root=${ANDROID_SDK_ROOT}
  21. - name: Validate checksum gradle wrapper
  22. uses: gradle/wrapper-validation-action@v1
  23. - name: Gradle cache
  24. id: cache
  25. uses: actions/cache@v2
  26. with:
  27. path: ~/.gradle/caches
  28. key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
  29. restore-keys: |
  30. ${{ runner.os }}-gradle-
  31. - name: Enable KVM group perms
  32. run: |
  33. echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
  34. sudo udevadm control --reload-rules
  35. sudo udevadm trigger --name-match=kvm
  36. - name: Build Debug APK
  37. run: |
  38. chmod +x gradlew
  39. ./gradlew assembleDebug
  40. - name: Build Release AAB
  41. id: buildRelease
  42. run: ./gradlew bundleRelease
  43. - name: Sign AAB
  44. id: sign
  45. uses: r0adkll/sign-android-release@v1
  46. with:
  47. releaseDirectory: app/build/outputs/bundle/release
  48. signingKeyBase64: ${{ secrets.SIGNING_KEY }}
  49. alias: ${{ secrets.ALIAS }}
  50. keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
  51. keyPassword: ${{ secrets.KEY_PASSWORD }}
  52. - name: Upload AAB/APK
  53. id: uploadArtifact
  54. uses: actions/upload-artifact@v1
  55. with:
  56. name: artifact
  57. path: |
  58. app/build/outputs/apk/release/app-release.apk
  59. app/build/outputs/bundle/release/app-release.aab
  60. - name: Releasing using Hub
  61. uses: ShaunLWM/action-release-debugapk@master
  62. env:
  63. GITHUB_TOKEN: ${{ secrets.GITHUB_RElEASE_TOKEN }}
  64. APP_FOLDER: app
  65. RELEASE_TITLE: Version
  66. - name: Create service_account.json
  67. id: createServiceAccount
  68. run: echo '${{ secrets.SERVICE_ACCOUNT_JSON }}' > service_account.json
  69. - name: Deploy to Play Store (BETA)
  70. id: deploy
  71. uses: r0adkll/upload-google-play@v1
  72. with:
  73. serviceAccountJson: service_account.json
  74. packageName: com.package
  75. releaseFile: app/build/outputs/bundle/release/app-release.aab
  76. track: beta
  77. whatsNewDirectory: whatsnew/
  78. - name: Notify on Slack
  79. uses: act10ns/slack@v1
  80. with:
  81. status: ${{ job.status }}
  82. steps: ${{ toJson(steps) }}
  83. if: always()