Skip to content

Commit

Permalink
Introduced the feature to upload application on non kiwix organisatio…
Browse files Browse the repository at this point in the history
…n. (#186)
  • Loading branch information
kelson42 authored Sep 30, 2024
2 parents f68f6cf + b111b9b commit bada9cf
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,25 @@ jobs:
- name: Copying custom app configuration into Kiwix Android code base
run: ./copy_files_to_kiwix_android.sh

- name: Set tag variable
run: echo "TAG=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV

- name: Install jq
run: sudo apt-get install -y jq

- name: Preparing signing material
env:
keystore: ${{ secrets.keystore }}
playstore_json: ${{ secrets.PLAYSTORE_JSON }}
run: |
echo "$playstore_json" > kiwix-android/playstore.json
echo "$keystore" | base64 -d > kiwix-android/kiwix-android.keystore
- name: Set tag variable
run: echo "TAG=$(echo ${GITHUB_REF:10})" >> $GITHUB_ENV

- name: Install jq
run: sudo apt-get install -y jq
non_kiwix_organization_tag='PLAYSTORE_JSON_'${TAG}
non_kiwix_playstore_json=${{ secrets[non_kiwix_organization_tag] || '' }}
if [ -n "$non_kiwix_playstore_json" ]; then
echo "$non_kiwix_playstore_json" > kiwix-android/playstore.json
else
echo "$playstore_json" > kiwix-android/playstore.json
fi
- name: Should upload Bundle
run: |
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,41 @@ All other further releases (without the `new` attribute in the
version". After a couple of hours the new version of the app should
be listed in the public Play Store.

## Releasing in your organisation

If you want to publish the application in your organization(Play store account),
kiwix requires a service account JSON file to automatically publish your app on play store.

### How to create Service Account

1. You need a GCP(Google Cloud Platform) account for this.
2. Create a project for your application in the GCP.
3. Enable the [AndroidPublisher](https://console.cloud.google.com/apis/library/androidpublisher.googleapis.com) API for that GCP project.
4. Create a [service account and key](https://console.cloud.google.com/apis/credentials/serviceaccountkey)
1. Make sure you're in the GCP project you used above (check the `project` query param in the
URL)
2. Select `New service account`
3. Give it a name and the Project Owner role.
4. After creating the service account, find it in the list of all service accounts and use the 3
dots menu to `Manage keys`
5. From there, create a new key using the `Add key` menu (leave JSON selected).
5. Give your service account
[permissions to publish apps](https://play.google.com/console/developers/users-and-permissions)
on your behalf.
1. Click `Invite new user`
2. Copy/paste the service account email (you can find it in the JSON credentials)
3. Don't touch the roles
4. Give the `Release apps to testing tracks` permission
<img alt="Minimum Service Account permissions" src="assets/min-perms.png" width="66%" />

6. We required that JSON file which was downloaded from the GCP for publishing your application.

### Initial Play Store upload

The first app bundle needs to be uploaded via the Google Play Console because registering the
app with the Play Store cannot be done using the Play Developer API.
After the initial upload, the application will be automatically uploaded by our CD process.

License
-------

Expand Down

0 comments on commit bada9cf

Please sign in to comment.