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"