Closed Haelle closed 3 years ago
@Haelle thanks for your request!
I do not know your current context. Could you tell us a bit more about what you are trying to do? Links to official documentation of related tools would be very helpful too.
Technically you could pass anything in customParameters
but it depends on the build method what happens to it.
What would be your suggested approach or desired API?
To deploy to the Google PlayStore you need to sign your application. It's done with a keystore.
In Unity you can then set your keystore in the Publishing menu.
And everytime you want to build your app you need to provide the password of the keystore via the Editor actually.
So for instance via Unity Cloud build you can provide in their web interface the keystore and the password (cannot show sorry). Here is the info in the FAQ section Android, 2rd question
I've never worked with the command line tool, so currently I have no idea how you're doing the command line build... I suppose there is a way to sign the app (as Unity Cloud Build does it !)
@Haelle did you find a solution for this?
Feel free to open a PR with your suggested approach. You're free to make any additions to the builder method, as long as it's usable for everyone.
This is in pending on my side, I'll come back to it later
@Haelle did you work this out? Anything we can reuse for everyone?
No sorry CI is postponed indefinitely for the moment
Added these parameters: androidAppBundle
, androidKeystoreName
, androidKeystoreBase64
, androidKeystorePass
, androidKeyaliasName
, androidKeyaliasPass
I tested with my personal project, but maybe someone else can test with their project to confirm? You would pass through GitHub Secrets in your workflow like this:
- uses: webbertakken/unity-builder@6ece6447b229baedca54df3aae22fc3d097bc4f3
with:
unityVersion: ${{ matrix.unityVersion }}
targetPlatform: ${{ matrix.targetPlatform }}
buildsPath: builds
androidAppBundle: true
androidKeystoreName: keystore.keystore
androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
androidKeystorePass: ${{ secrets.ANDROID_KEYSTORE_PASS }}
androidKeyaliasName: ${{ secrets.ANDROID_KEYALIAS_NAME }}
androidKeyaliasPass: ${{ secrets.ANDROID_KEYALIAS_PASS }}
@davidmfinol did you successfully built & sign android? I had working Android build then added the android signing options in order to publish to Google Play and it fails:
UnityException: Can not sign the application Unable to sign the application; please provide passwords!
https://github.com/louis030195/niwrad/runs/1221825955?check_suite_focus=true#step:4:3197
However i properly set my secrets etc.
Run webbertakken/unity-builder@v1.2 with: customParameters: -niwradMode offline projectPath: . unityVersion: 2019.4.11f1 targetPlatform: Android buildMethod: Editor.Builds.BuildOptions androidAppBundle: true androidKeystoreName: .keystore androidKeystoreBase64: androidKeystorePass: androidKeyaliasName: androidKeyaliasPass: buildsPath: builds kubeContainerMemory: 800M kubeContainerCPU: 0.25 kubeVolumeSize: 5Gi versioning: Semantic env: UNITY_LICENSE:
https://github.com/louis030195/niwrad/runs/1221825955?check_suite_focus=true#step:4:1
What is actually "androidKeystoreName" ? Since you store the b64 keystore in your secrets ...
I generated my keys using unity IDE btw (first tried CLI but better trust Unity ...)
FYI my Android build config
learned that you can't do arm64 with Mono, so IL2CPP has to be used and target API should be >=29 to publish to Google Play.
I had working Android builds, but they've been broken for a while now, since the Android images don't have the Android NDK properly set. Are you able to get past that error?
The androidKeystoreName is the name of the file, while androidKeystoreBase64 is the contents of that file, encoded in base64.
Your workflow looks good to me. Are you applying the passwords in your Editor.Builds.BuildOptions method? If not, see https://github.com/finol-digital/Card-Game-Simulator/blob/e3d90591b5df4b0b4be9dc64a913da5084eeedad/Assets/Scripts/Cgs/Editor/BuildCgs.cs#L35 for how it can be done.
I had working Android builds, but they've been broken for a while now, since the Android images don't have the Android NDK properly set. Are you able to get past that error?
The androidKeystoreName is the name of the file, while androidKeystoreBase64 is the contents of that file, encoded in base64.
Your workflow looks good to me. Are you applying the passwords in your Editor.Builds.BuildOptions method? If not, see https://github.com/finol-digital/Card-Game-Simulator/blob/e3d90591b5df4b0b4be9dc64a913da5084eeedad/Assets/Scripts/Cgs/Editor/BuildCgs.cs#L35 for how it can be done.
I don't understand "The androidKeystoreName is the name of the file", you don't commit any keystore file anywhere, it's just base64 content ? What file are you referring to ?
I think this doc is much nicer, I hope something similar would be put on the unity-ci website https://gitlab.com/gableroux/unity3d-gitlab-ci-example#android-support
Thanks for the build options, now I'm stuck at the same point as you : Android NDK, would be nice to automatically use an image with android ndk whenever it's required (building .aab ?).
Also wondering how it works for the api levels if the image can build for any sdk version ?
This is the PR that indended to do that (until i renamed master
to main
). It's a work in progress by @GabLeRoux
Feel free to contribute and help out.
Could you also elaborate on what's nicer about it exactly? Perhaps we could learn from that.
Also curious on that, but I happen to have gone through the unity-ci docs for github-actions today and I think that the main difference is the approach.
Right now, github-actions documentation provides parts of code that you need to assemble on your own to get things working where on unity3d-gitlab-ci-example's side, you simply grab the files, add them to your project and follow activation steps.
I think this can be easily solved by providing working files out of the box in the documentation and then do the more modular explanation on how things work and how they can customize it for people who want to go deeper.
I'd say most of the use cases are the following:
Everything else is probably secondary.
Yea fully agree! Anyone is free to edit the docs or describe feature requests here.
I see you've already created one issue regarding improvements https://github.com/Unity-CI/Website/issues/46 @GabLeRoux, thanks!
Since keystore & password are supported now, do we want to close this issue?
Or do we want to keep this issue open until the documentation is improved?
Yea lets close it. Anyone is free to add to the docs.
Is there a way to pass the keystore file in the parameters ? And also the password ? (using github secrets)
Should it be in the
customParameters
?