r0adkll / sign-android-release

A GitHub action to sign an APK or AAB
MIT License
362 stars 137 forks source link

directory is not found #15

Closed abhi8422 closed 4 years ago

abhi8422 commented 4 years ago

[error]ENOENT: no such file or directory, scandir 'app/build/outputs/apk/release'

r0adkll commented 4 years ago

Could you please post your workflow YAML configuration? (or at least the signing portion of it)

abhi8422 commented 4 years ago

name: Android CI on: push: branches: [ master ] pull_request: branches: [ master ]

jobs: apk: name: Generate APK runs-on: ubuntu-18.04

steps:
  - uses: actions/checkout@v2
  - name: set up JDK 1.8
    uses: actions/setup-java@v1
    with:
      java-version: 1.8
  - name: Build debug APK
    run: bash ./gradlew assembleDebug --stacktrace
  - name: Upload APK
    uses: actions/upload-artifact@v1
    with:
      name: app
      path: app/build/outputs/apk/debug/app-debug.apk
  - name: Sign Android release
    uses: r0adkll/sign-android-release@v1
    with:
      releaseDirectory: app/build/outputs/apk/release
     signingKeyBase64: ${{ secrets.SIGNING_KEY }}
     alias: ${{ secrets.ALIAS }}
    keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
   keyPassword: ${{ secrets.KEY_PASSWORD }}

Pushing it on the master branch.

r0adkll commented 4 years ago

Okay so here:

bash ./gradlew assembleDebug --stacktrace

you are building the debug variant of your application (which, btw, you should be able to just call ./gradlew assembleDebug --stacktrace without the bash command, hence why the ./ is there)

And in your signing configuration, you are specifying the /release folder for your apk outputs which is why the action can't find any apks. What you should be doing is running ./gradlew assembleRelease to assemble the release build of your app. This means you'll have to update your upload-artifact action as well to point to the release build too.

abhi8422 commented 4 years ago

Working now. Thank You.

abhi8422 commented 4 years ago

The action is working fine but in Artifacts, it's giving me three .apk files

  1. app-release-unsigned-aligned.apk
  2. app-release-unsigned-signed.apk(this is the only one which is signed)
  3. app-release-unsigned.apk

Workflow code->

steps:
  - uses: actions/checkout@v2
  - name: Set up JDK 1.8
    uses: actions/setup-java@v1
    with:
      java-version: 1.8
  - name: Build
    run: ./gradlew build
  - name: Assemble Release Bundle
    run: |
      ./gradlew assembleRelease
  - name: Sign Release
    uses: r0adkll/sign-android-release@v1
    with:
      releaseDirectory: app/build/outputs/apk/release
      signingKeyBase64: ${{ secrets.SIGNING_KEY }}
      alias: ${{ secrets.ALIAS }}
      keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
      keyPassword: ${{ secrets.KEY_PASSWORD }}
  - name: Upload APK
    uses: actions/upload-artifact@v2
    with:
      name: app
      path: app/build/outputs/apk/release
r0adkll commented 4 years ago

Yes, I should probably have the action clean up it's "mess". This action generates the -aligned.apk when it zipaligns the APK, and then generates the -signed.apk version when it actually signs it. I'm going to close this issue and open a new one to remind me to do so

bishwajeetbiswas commented 3 years ago

Hi @r0adkll Please help me to fix this issue:

Screenshot 2021-09-30 at 3 36 11 PM

My Source code:

  - name: Sign APK
    uses: r0adkll/sign-android-release@v1
    # ID used to access action output
    id: sign_app
    with:
      releaseDirectory: app/build/outputs/apk/release
      signingKeyBase64: ${{ secrets.SIGN_KEY }}
      alias: ${{ secrets.ALIAS }}
      keyStorePassword: ${{ secrets.KEY_STORE_PASS }}
      keyPassword: ${{ secrets.KEY_PASS }}

  - name: Upload file to github
    uses: actions/upload-artifact@v2
    with:
      name: App Release
      path: ${{steps.sign_app.outputs.signedReleaseFile}}