Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial setup for publishing app to play store #2156

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/playstore-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Staging Deploy

on:
push:
branches: [ "release" ]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.2
bundler-cache: true

- name: Run tests
run: bundle exec fastlane android test

- name: Create Google Play Service Account Key file
uses: timheuer/base64-to-file@v1
id: service_account_json_file
with:
fileName: "serviceAccount.json"
encodedString: ${{ secrets.GPLAY_SERVICE_ACCOUNT_KEY }}

- name: Create Keystore file
uses: timheuer/base64-to-file@v1
id: android_keystore
with:
fileName: "android_keystore.keystore"
encodedString: ${{ secrets.STAGING_KEYSTORE_FILE }}

- name: Deploy Android release
run: bundle exec fastlane android deploy
env:
STAGING_PACKAGE_NAME: ${{ secrets.STAGING_PACKAGE_NAME }}
STAGING_KEYSTORE_FILE: ${{ steps.android_keystore.outputs.filePath }}
STAGING_KEYSTORE_PASSWORD: ${{ secrets.STAGING_KEYSTORE_PASSWORD }}
STAGING_KEY_ALIAS: ${{ secrets.STAGING_KEY_ALIAS}}
STAGING_KEY_PASSWORD: ${{ secrets.STAGING_KEY_PASSWORD }}
GPLAY_SERVICE_ACCOUNT_KEY: ${{ steps.service_account_json_file.outputs.filePath }}

- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: assets
path: |
${{ github.workspace }}/app/build/outputs/bundle/release
61 changes: 61 additions & 0 deletions .github/workflows/release-and-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CD

on:
workflow_run:
workflows: ["ci"]
types:
- completed

jobs:
apk:
name: Build Release signed APK
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2

- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: '17'

- name: Build Release APK
run: ./gradlew assembleRelease

- name: Sign APK
uses: r0adkll/sign-android-release@v1
id: sign_app
with:
releaseDirectory: app/build/outputs/apk/release
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
alias: ${{ secrets.KEY_ALIAS }}
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
keyPassword: ${{ secrets.KEY_PASSWORD }}
env:
BUILD_TOOLS_VERSION: "30.0.2"

- name: Upload Signed APK
uses: actions/upload-artifact@v2
with:
name: sample-app-signed # Artifact Name
path: app/build/outputs/apk/release/*.apk

deploy:
name: Deploy release AAB on Playstore
needs: [apk]
runs-on: ubuntu-latest
steps:
- name: Create service_account.json
run: echo '${{ secrets.SERVICE_ACCOUNT_JSON }}' > service_account.json

- name: Deploy to Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: service_account.json
packageName: ${{ github.event.inputs.app_id }}
releaseFiles: app/build/outputs/bundle/release/*.aab
track: internal
whatsNewDirectory: whatsnew/
mappingFile: app/build/outputs/mapping/release/mapping.txt
inAppUpdatePriority: 5
96 changes: 96 additions & 0 deletions .github/workflows/test-and-debug-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: CI

on:
push:
branches: [ "release" ]

jobs:
lint:
name: Perform lint check
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2

- name: Cache Gradle
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Make Gradle executable
run: chmod +x ./gradlew

- name: Run lint
run: ./gradlew lintDebug

- name: Upload html test report
uses: actions/upload-artifact@v2
with:
name: lint.html
path: app/build/reports/lint-results-debug.html

unit-test:
name: Perform Unit Testing
needs: [lint]
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2

- name: Run tests
run: ./gradlew test

- name: Upload test report
uses: actions.upload-artifact@v2
with:
name: unit_test_report
path: app/build/reports/test/testDebugUnitTest/

instrumentation-test:
name: Perform Instrumentation Testing
needs: [unit-test]
runs-on: macos-latest # MacOS runs faster
steps:
- name: Checkout the code
uses: actions/checkout@v2

# Gradle v8.0.0 requires java JDK v17
- name: Set up Java JDK 17
uses: actions/setup-java@v1
with:
java-version: '17'

- name: Run espresso tests
uses: reactivecircus/android-emulator-runner@v2 # 3rd party tool
with:
api-level: 29
script: ./gradlew connectedCheck

- name: Upload Instrumentation Test report
uses: actions/upload-artifact@v2
with:
name: instrumentation_test_report
path: app/build/reports/androidTests/connected

debug-apk:
name: Generate Debug APK
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2

- name: Set up Java JDK 17
uses: actions/setup-java@v1
with:
java-version: '17'

- name: Build debug APK
run: ./gradlew assembleDebug --stacktrace

- name: Upload APK
uses: actions/upload-artifact@v2
with:
name: sample-app.apk
path: app/build/outputs/apk/debug/app-debug.apk
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source "https://rubygems.org"

gem "fastlane"

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
Loading
Loading