diff --git a/.github/workflows/playstore.yaml b/.github/workflows/playstore.yaml index 5f2c4093..644b2ad3 100644 --- a/.github/workflows/playstore.yaml +++ b/.github/workflows/playstore.yaml @@ -13,29 +13,16 @@ jobs: uses: actions/checkout@v4 - name: Setup ruby - uses: actions/setup-ruby@v1 + uses: ruby/setup-ruby@v1 with: - ruby-version: "3.x" - - - name: Setup fastlane - run: | - cd enioka_scan - bundle install - cd .. + ruby-version: "3.0.2" + bundler-cache: true - name: Restore json key # make sure that you restore the key in the correct directory (ref. fastlane/Appfile) - run: | - cd enioka_scan - cd fastlane - echo "${{ secrets.GOOGLE_API_PUB_JSON }}" | base64 --decode > service-account.json - cd ../.. + run: echo "${{ secrets.GOOGLE_API_PUB_JSON_BASE64 }}" | base64 --decode > ${{ github.workspace }}/service-account.json - name: Restore keystore # make sure that you restore the key in the correct directory (same as app/gradle.properties) - run: | - cd enioka_scan/app - echo "${{ secrets.SIGN_KEY }}" > myKeystore.keystore.asc - gpg -d --passphrase ${{ secrets.SIGN_PASSWORD }} --batch myKeystore.keystore.asc > myKeystore.keystore - cd ../.. + run: echo "${{ secrets.GOOGLE_KEYSTORE_BASE64 }}" | base64 --decode > ${{ github.workspace }}/demoscannerapp/debug.keystore - name: Set up environment uses: actions/setup-java@v4 @@ -46,7 +33,19 @@ jobs: - name: Gradle cache uses: gradle/actions/setup-gradle@v3 - - name: Upload app to Play Store (Internal track) - run: | - cd enioka_scan - bundle exec fastlane internal + - name: Build with Gradle + run: ./gradlew demoscannerapp:assembleDebug + env: + KEYSTORE_PASSWORD: ${{ secrets.GOOGLE_KEYSTORE_PASSWORD }} + SIGNKEY_PASSWORD: ${{ secrets.GOOGLE_SIGNKEY_PASSWORD }} + KEY_ALIAS: ${{ secrets.GOOGLE_SIGNKEY_ALIAS }} + + - name: Upload apk artifact + uses: actions/upload-artifact@v4 + with: + name: app-debug + path: ${{ github.workspace }}/demoscannerapp/build/outputs/apk/debug/demoscannerapp-debug-signed.apk + +# - name: Upload app to Play Store (Internal track) +# run: bundle exec fastlane internal + diff --git a/buildSrc/src/main/groovy/scanner.signing-library.gradle b/buildSrc/src/main/groovy/scanner.signing-library.gradle new file mode 100644 index 00000000..70eb99d8 --- /dev/null +++ b/buildSrc/src/main/groovy/scanner.signing-library.gradle @@ -0,0 +1,19 @@ +plugins { + id 'signing' +} + +signing { + useInMemoryPgpKeys( + System.getenv("SIGN_KEYID"), + System.getenv("SIGN_KEY"), + System.getenv("SIGN_PASSWORD") + ) + sign project.tasks.register('signFile', Sign) { + sign project.file('demoscannerapp/build/outputs/bundle/debug/demoscannerapp-debug.aab') + outputs.project.file('demoscannerapp/build/outputs/bundle/debug/demoscannerapp-debug-signed.aab') + } +} + +tasks.register('assembleSigned') { + dependsOn 'signFile' +} diff --git a/demoscannerapp/build.gradle b/demoscannerapp/build.gradle index 7a81d975..57317279 100644 --- a/demoscannerapp/build.gradle +++ b/demoscannerapp/build.gradle @@ -12,6 +12,14 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } + signingConfigs { + debug { + storeFile file("debug.keystore") + storePassword System.getenv("KEYSTORE_PASSWORD") + keyAlias System.getenv("KEY_ALIAS") + keyPassword System.getenv("SIGNKEY_PASSWORD") + } + } buildTypes { release { minifyEnabled true @@ -21,6 +29,7 @@ android { applicationIdSuffix ".release" } debug { + signingConfig signingConfigs.debug debuggable true applicationIdSuffix ".debug" } diff --git a/fastlane/Appfile b/fastlane/Appfile index 6d2371b2..c98263f0 100644 --- a/fastlane/Appfile +++ b/fastlane/Appfile @@ -1,2 +1 @@ -json_key_file("fastlane/service-account.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one -package_name("com.enioka.scanner.demo") # e.g. com.krausefx.app +json_key_file("service-account.json") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 81893eab..f3ffced1 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -23,11 +23,15 @@ platform :android do # Generate AAB file gradle( - task: "bundle", - build_type: "Release" + task: "demoscannerapp:bundle", + build_type: "Debug" ) # Upload the AAB to play store (internal track) - upload_to_play_store(track: 'internal', validate_only: true) + upload_to_play_store( + package_name: "com.enioka.scanner.demoscannerapp.debug", + track: 'internal', + validate_only: true + ) end end