ilharp / sign-android-release

A GitHub action to sign an APK or AAB
https://github.com/marketplace/actions/sign-android-release-2
MIT License
43 stars 10 forks source link

Signing is not working #22

Open Marco-9456 opened 3 weeks ago

Marco-9456 commented 3 weeks ago

Hello, I'm recently getting the following error:

on: workflow_dispatch:

jobs:

build: runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: set up JDK 21
  uses: actions/setup-java@v4
  with:
    java-version: '21'
    distribution: 'temurin'
    cache: 'gradle'

- name: Setup Android SDK
  uses: android-actions/setup-android@v3

- uses: gradle/actions/setup-gradle@v3

- run: gradle assembleRelease

- name: Sign app APK
  id: sign_app
  uses: ilharp/sign-android-release@nightly
  with:
    releaseDir: app/build/outputs/apk/release
    signingKey: ${{ secrets.SIGNING_KEY }}
    keyAlias: ${{ secrets.ALIAS }}
    keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
    keyPassword: ${{ secrets.KEY_PASSWORD }}

- name: Upload Artifact
  uses: actions/upload-artifact@v4
  with:
    name: signed-apks
    path: app/build/outputs/apk/release/*-arm64-v8a-release-signed.apk
    if-no-files-found: error
    retention-days: 20

- Error
```Yaml
Run ilharp/sign-android-release@nightly
  with:
    releaseDir: app/build/outputs/apk/release
    signingKey: ***
    keyAlias: ***
    keyStorePassword: ***
    keyPassword: ***
  env:
    JAVA_HOME: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/[2](https://github.com/Marco-9456/Seal/actions/runs/10435909442/job/28900355148#step:7:2)1.0.4-7/x64
    JAVA_HOME_21_X64: /opt/hostedtoolcache/Java_Temurin-Hotspot_jdk/21.0.[4](https://github.com/Marco-9456/Seal/actions/runs/10435909442/job/28900355148#step:7:4)-7/x64
    ANDROID_HOME: /usr/local/lib/android/sdk
    ANDROID_SDK_ROOT: /usr/local/lib/android/sdk
    GRADLE_ACTION_ID: gradle/actions/setup-gradle
    GRADLE_BUILD_ACTION_SETUP_COMPLETED: true
    GRADLE_BUILD_ACTION_CACHE_RESTORED: true
    DEVELOCITY_INJECTION_INIT_SCRIPT_NAME: gradle-actions.inject-develocity.init.gradle
    DEVELOCITY_AUTO_INJECTION_CUSTOM_VALUE: gradle-actions
    GITHUB_DEPENDENCY_GRAPH_ENABLED: false
Error: Error: ENOENT: no such file or directory, open 'app/build/outputs/apk/release/key.jks'
Error: Error: ENOENT: no such file or directory, open 'app/build/outputs/apk/release/key.jks'
ilharp commented 3 weeks ago
Error: Error: ENOENT: no such file or directory, open 'app/build/outputs/apk/release/key.jks'

That error is a bit strange. One possible reason is, gradle assembleRelease runs successfully, but app/build/outputs/apk/release folder is not created.

Could you please:

  1. Temporarily disable the sign-android-release step
  2. Set the path option of upload-artifact to app/build/outputs/apk/release

To observe the operation and output files of gradle assembleRelease itself?

An example of modifying the workflow:

    - run: gradle assembleRelease

#     - name: Sign app APK
#       id: sign_app
#       uses: ilharp/sign-android-release@nightly
#       with:
#         releaseDir: app/build/outputs/apk/release
#         signingKey: ${{ secrets.SIGNING_KEY }}
#         keyAlias: ${{ secrets.ALIAS }}
#         keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
#         keyPassword: ${{ secrets.KEY_PASSWORD }}

    - name: Upload Artifact
      uses: actions/upload-artifact@v4
      with:
        name: signed-apks

        ###################################
        path: app/build/outputs/apk/release
        ###################################

        if-no-files-found: error
        retention-days: 20

If the workflow runs successfully, please pay attention to the log of the upload-artifact step, which will output the full path of the unsigned apks. Please paste their full path in reply.

Marco-9456 commented 3 weeks ago

If the workflow runs successfully, please pay attention to the log of the upload-artifact step, which will output the full path of the unsigned apks. Please paste their full path in reply.

This is what I'm getting now:

Error: No files were found with the provided path: app/build/outputs/apk/release. No artifacts will be uploaded.
ilharp commented 3 weeks ago
Error: No files were found with the provided path: app/build/outputs/apk/release. No artifacts will be uploaded.

Seems that I guessed it right - gradle assembleRelease runs successfully, but app/build/outputs/apk/release is not created. Maybe the generated apk is somewhere else, or gradle assembleRelease did not compile and generate the apk at all.

Since your project still won't build properly without sign-android-release enabled, there's not much I can do to help you. As my personal advice, I recommend:

Marco-9456 commented 3 weeks ago

Thanks a lot, I'll see what I can do.