How to decode jks keystore file for signing the Android app? #20177
-
I try to setup Android with Fastlane. Unfortunatelly the app cannot be signed with the upload key on GitHub Action. (Locally it works)
On my local machine I have two files:
For GitHub Actions I convert both files into base64, copy them from terminal and save them as repository secret.
My build-android.yml is this: name: Android binary build & upload
on:
push:
branches: [ main ]
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- name: Get Flutter stable
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter doctor
- uses: actions/setup-java@v1
with:
java-version: '12.x'
- name: Checkout and get packages
uses: actions/checkout@v2
- run: flutter pub get
- name: Setup Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.2
bundler-cache: true
working-directory: android
- run: cd android && bundle install && cd ..
- name: Decode keystore and create jks and properties file for signing the app
run: |
echo "$PLAY_STORE_UPLOAD_KEY" | base64 --decode > app/keystore.jks
echo "storeFile=keystore.jks" >> key.properties
echo "keyAlias=$KEYSTORE_KEY_ALIAS" >> key.properties
echo "storePassword=$KEYSTORE_STORE_PASSWORD" >> key.properties
echo "keyPassword=$KEYSTORE_KEY_PASSWORD" >> key.properties
env:
PLAY_STORE_UPLOAD_KEY: ${{ secrets.PLAY_STORE_UPLOAD_KEY }}
KEYSTORE_KEY_ALIAS: ${{ secrets.KEYSTORE_KEY_ALIAS }}
KEYSTORE_KEY_PASSWORD: ${{ secrets.KEYSTORE_KEY_PASSWORD }}
KEYSTORE_STORE_PASSWORD: ${{ secrets.KEYSTORE_STORE_PASSWORD }}
working-directory: android
- name: Decode PlayStore credentials and create credentials.json file for upload
run: |
echo "$PLAY_STORE_CONFIG_JSON" | base64 --decode > api.json
env:
PLAY_STORE_CONFIG_JSON: ${{ secrets.PLAY_STORE_CONFIG_JSON }}
# Build and deploy with Fastlane (by default, to beta track) 🚀.
# Naturally, promote_to_production only deploys.
- name: Build Android app and deploy to PlayStore
run: |
bundle exec fastlane deploy
working-directory: android My Fastfile:
My Appfile:
Any idea what's wrong? Thanks alot!!! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Haven't found a solution so far, but looks like problem arises because I (1) encode the jks file on Mac and (2) the jks get decoded on Ubuntu.
|
Beta Was this translation helpful? Give feedback.
-
I solved it in a different way, described here. I created a zip file and encrypted it with gpg. The zip file is stored directly inside the git repo and will be decrypted from GitHub action. |
Beta Was this translation helpful? Give feedback.
-
i not sure, but i just use simple command.
and for decoding to jks in github action i use
|
Beta Was this translation helpful? Give feedback.
I solved it in a different way, described here. I created a zip file and encrypted it with gpg. The zip file is stored directly inside the git repo and will be decrypted from GitHub action.