From 6e19eb943d271094e919d06a10614f2eb5f4bfb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Mon, 29 Mar 2021 17:37:26 +0200 Subject: [PATCH] Add deploy to AppGallery github actions config (#1259) --- .github/workflows/test.yml | 38 ++++++++++++++++++++++++++++++++++++++ app/build.gradle | 12 ++++++++++++ build.gradle | 1 + 3 files changed, 51 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a81b333f..c26a50bc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -69,6 +69,44 @@ jobs: PLAY_STORE_PASSWORD: ${{ secrets.PLAY_STORE_PASSWORD }} run: ./gradlew publishPlayRelease -PenableFirebase --stacktrace; + deploy-app-gallery: + name: Deploy to AppGallery + runs-on: ubuntu-latest + timeout-minutes: 10 + environment: app-gallery + needs: [ unit-tests ] + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-java@v1 + with: + java-version: 11 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }} + - name: Decrypt keys + env: + ENCRYPT_KEY: ${{ secrets.ENCRYPT_KEY }} + SERVICES_ENCRYPT_KEY: ${{ secrets.SERVICES_ENCRYPT_KEY }} + run: | + gpg --yes --batch --passphrase=$SERVICES_ENCRYPT_KEY ./app/src/release/agconnect-services.json.gpg + gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/key.p12.gpg + gpg --yes --batch --passphrase=$ENCRYPT_KEY ./app/upload-key.jks.gpg + - name: Build HMS version + env: + PLAY_KEY_ALIAS: ${{ secrets.PLAY_KEY_ALIAS }} + PLAY_KEY_PASSWORD: ${{ secrets.PLAY_KEY_PASSWORD }} + PLAY_STORE_PASSWORD: ${{ secrets.PLAY_STORE_PASSWORD }} + run: ./gradlew assembleHmsRelease --stacktrace + - name: Upload APK to AppGallery + env: + AGC_CLIENT_ID: ${{ secrets.AGC_CLIENT_ID }} + AGC_CLIENT_SECRET: ${{ secrets.AGC_CLIENT_SECRET }} + run: ./gradlew publishHuaweiAppGalleryHmsRelease --stacktrace; + deploy-appcenter: name: Deploy to App Center runs-on: ubuntu-latest diff --git a/app/build.gradle b/app/build.gradle index 80496ff1..a9e9ed76 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -4,6 +4,7 @@ apply plugin: 'kotlin-kapt' apply plugin: 'dagger.hilt.android.plugin' apply plugin: 'com.google.firebase.crashlytics' apply plugin: 'com.github.triplet.play' +apply plugin: 'ru.cian.huawei-publish' apply plugin: 'com.mikepenz.aboutlibraries.plugin' apply plugin: 'com.google.gms.google-services' apply plugin: 'com.huawei.agconnect' @@ -140,6 +141,17 @@ play { updatePriority = 3 } +huaweiPublish { + instances { + hmsRelease { + clientId = System.getenv("AGC_CLIENT_ID") + clientSecret = System.getenv("AGC_CLIENT_SECRET") + buildFormat = "apk" + deployType = "draft" + } + } +} + ext { work_manager = "2.5.0" work_hilt = "1.0.0-beta01" diff --git a/build.gradle b/build.gradle index 21ae47e7..222ea177 100644 --- a/build.gradle +++ b/build.gradle @@ -19,6 +19,7 @@ buildscript { classpath 'com.huawei.agconnect:agcp:1.5.1.200' classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1' classpath "com.github.triplet.gradle:play-publisher:2.8.0" + classpath "ru.cian:huawei-publish-gradle-plugin:1.2.2" classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.1.1" classpath "gradle.plugin.com.star-zero.gradle:githook:1.2.0" classpath "com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:$about_libraries"