Today, I want to share with you how you can store the key for signing your android application. It is clear that we can’t store by version control system, we should store it as secret. There is a problem in that in the most of the services for CI you can’t store binaries just secrets as plain text. Base algorithm to solve this problem is converting binary to text representation and converting text to binary representation when we need keystore again.
One is the best candidates for this is Base64 format. Both operation, you can simply do by terminal.
Encoding:
base64 -i key.jks -o key.b64
Decoding:
base64 --decode key.b64 > key.jks
How result, you only need to store text representation of your key in secrets and restore it during execution of pipeline. For instance, how it will be looked if you use GitHub action for this:
- name: Decode and save signing key run: | echo "${{ secrets.SIGNING_KEY_BASE64 }}" | base64 --decode > key.jks
Discover more from Coursity
Subscribe to get the latest posts sent to your email.