Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signing release APKs on GitHub Actions? #326

Closed
torokati44 opened this issue Aug 14, 2022 · 7 comments
Closed

Signing release APKs on GitHub Actions? #326

torokati44 opened this issue Aug 14, 2022 · 7 comments

Comments

@torokati44
Copy link

torokati44 commented Aug 14, 2022

I have some difficulties signing my release builds on GitHub Actions due to #299.

A while ago, it was enough to have these secrets set up for GitHub Actions:

Screenshot_20220814_224344

And then do this in the .yml config of the workflow:

    - name: Decode keystore
      if: ${{ !github.event.pull_request.head.repo.fork }}
      env:
          ENCODED_STRING: ${{ secrets.KEYSTORE }}
      run: |
          echo $ENCODED_STRING | base64 -di > app/ruffle/androidkey.jks

    - name: Build release APK
      if: ${{ !github.event.pull_request.head.repo.fork }}
      run: |
        cd app
        ./gradlew assembleRelease
      env:
        SIGNING_KEY_ALIAS: ${{ secrets.SIGNING_KEY_ALIAS }}
        SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }}
        SIGNING_STORE_PASSWORD: ${{ secrets.SIGNING_STORE_PASSWORD }}

And have this in build.gradle:

    signingConfigs {
        release {
            storeFile = file("androidkey.jks")
            storePassword System.getenv("SIGNING_STORE_PASSWORD")
            keyAlias System.getenv("SIGNING_KEY_ALIAS")
            keyPassword System.getenv("SIGNING_KEY_PASSWORD")
        }
    }

And I could build release .apks on GitHub CI this way.

But now, I'm not sure how I could get these secrets into Cargo.toml, or how I could avoid having to do so.
Now I get this: Error: Configure a release keystore via '[package.metadata.android.signing.release]'
See: https://github.com/torokati44/ruffle-android/runs/7828734259?check_suite_focus=true

@torokati44
Copy link
Author

Okay, I ended up generating a dummy keystore manually to be used by cargo-apk.
I forgot that I don't actually use or need that APK, only the native libraries that it produces as a side effect...
Oops, sorry for the spam! 😅

@MarijnS95
Copy link
Member

MarijnS95 commented Aug 15, 2022

You should also be able to use cargo apk -- build [cargo args] which'll invoke cargo build [cargo args] with all the right things set in the env, but without making a final apk.

@torokati44
Copy link
Author

I see, thanks for the tip!

@torokati44
Copy link
Author

I was able to make it work with cargo apk -- build --release, but then I don't know where to find libc++_shared.so...

@torokati44
Copy link
Author

Okay, I found them at $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/aarch64-linux-android/libc++_shared.so and $ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/lib/arm-linux-androideabi/libc++_shared.so!

@MarijnS95
Copy link
Member

@torokati44 Well, that's one of the steps cargo-apk does for you when packaging an APK 😬 (which you don't use, but there are alternative solutions that may help as well).

@torokati44
Copy link
Author

Well, yes... 😅 Thankfully I was able to get rid of my only C++ dependency (Oboe) since, so this is no longer relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants