flashlight icon indicating copy to clipboard operation
flashlight copied to clipboard

Error: File 'android/app/build/outputs/bundle/stagingRelease/APP_NAME.aab' is a directory. when running in CI

Open honeycombharris opened this issue 2 years ago • 1 comments

Hi,

I'm trying to integrate flashlight within a github actions workflow and when trying to run the CLI, I get the following error: CleanShot 2023-10-10 at 17 26 04@2x

I'm quite stumped by this. here is what the github actions steps look like:


      - name: Sign Android release
        uses: r0adkll/sign-android-release@v1
        id: sign_app
        with:
          signingKeyBase64: ${{ secrets.APPCENTER_ANDROID_KEY_PAYLOAD }}
          alias: ${{ secrets.APPCENTER_ANDROID_KEY_ALIAS }}
          keyStorePassword: ${{ secrets.APPCENTER_ANDROID_KEYSTORE_PASSWORD }}
          keyPassword: ${{ secrets.APPCENTER_ANDROID_KEY_PASSWORD }}
          releaseDirectory: android/app/build/outputs/bundle/stagingRelease

      - name: Make artifact
        id: make_artifact
        uses: actions/upload-artifact@v3
        with:
          name: app-release-signed
          path: ${{steps.sign_app.outputs.signedReleaseFile}}

      - uses: actions/checkout@v3
      - name: Download artifact
        uses: actions/download-artifact@v3
        with:
          name: app-release-signed
          path: ${{steps.sign_app.outputs.signedReleaseFile}}

      - name: Install Flashlight CLI
        run: |
          curl https://get.flashlight.dev/ | bash
          echo "$HOME/.flashlight/bin" >> $GITHUB_PATH

      - name: Print signedReleaseFile path
        run: echo ${{steps.sign_app.outputs.signedReleaseFile}}

      - name: Run Flashlight CLI
        env:
          FLASHLIGHT_API_KEY: ${{ secrets.FLASHLIGHT_API_KEY }}
        run: |
          flashlight cloud --app ${{steps.sign_app.outputs.signedReleaseFile}} --test ./e2e/tests/chats/community-chat.e2e.yml --beforeAll ./e2e/tests/login/login.e2e.yml --apiKey $FLASHLIGHT_API_KEY

Why would the signed release path be considered a directory and not a file?

[BT:1.14.0*** Error: File 'android/app/build/outputs/bundle/stagingRelease/app-staging-release.aab' is a directory.
java.lang.IllegalArgumentException: File 'android/app/build/outputs/bundle/stagingRelease/app-staging-release.aab' is a directory.
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:[22](https://github.com/stanforddesi/eclipse-rn/actions/runs/6471517780/job/17570120942#step:17:22)0)
	at com.android.tools.build.bundletool.model.utils.files.FilePreconditions.checkFileExistsAndReadable(FilePreconditions.java:37)
	at com.android.tools.build.bundletool.commands.BuildApksCommand.validateInput(BuildApksCommand.java:942)
	at com.android.tools.build.bundletool.commands.BuildApksCommand.execute(BuildApksCommand.java:888)
	at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:83)
	at com.android.tools.build.bundletool.BundleToolMain.main(BundleToolMain.java:55)
unzip:  cannot find or open myapp.apks, myapp.apks.zip or myapp.apks.ZIP.
/snapshot/flashlight-cloud/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: Command failed: 
              keytool -genkey -v -dname OU=flashlight -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000 -storepass azerty -keypass azerty

              curl https://github.com/google/bundletool/releases/download/1.14.0/bundletool-all-1.14.0.jar -L -o bundletool.jar

              java -jar bundletool.jar build-apks --bundle=android/app/build/outputs/bundle/stagingRelease/app-staging-release.aab                 --output=myapp.apks                 --mode=universal                 --ks=my-release-key.keystore                 --ks-key-alias=alias_name                 --ks-pass=pass:azerty

              unzip myapp.apks -d apks
            
Generating 2,048 bit RSA key pair and self-signed certificate (SHA[25](https://github.com/stanforddesi/eclipse-rn/actions/runs/6471517780/job/17570120942#step:17:25)6withRSA) with a validity of 10,000 days
	for: OU=flashlight

honeycombharris avatar Oct 10 '23 16:10 honeycombharris

this issue was resolved by simply genearting an APK instead of .aab.

harrisrobin avatar Oct 11 '23 17:10 harrisrobin

Hi @honeycombharris, is this still an issue with the latest Flashlight versions?

You can upgrade flashlight with this command:

curl https://get.flashlight.dev/ | bash

in the meantime, I'm closing this issue, but feel free to reopen if not fixed!

Almouro avatar Sep 06 '24 14:09 Almouro