Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/playstore-internal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Publish to Play Store Internal Track

on:
workflow_dispatch:
push:
branches: [ 'release/**', 'copilot/add-github-action-playstore' ]

# Cancel any in-progress runs of this workflow if a new run is triggered within the same branch or PR
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
runs-on: macos-latest # use [ self-hosted, macOS ] to host on our own mac mini, which is twice as fast and cheaper than hosting on a github runner. See README for more info.
steps:
- uses: actions/checkout@v4
- name: Prepare Release
uses: ./.github/actions/prepare-release

# This will decode the keystore from base 64 text representation that we have stored in secrets
# and generates and keystore file and gets stored in /android-app path
- name: Decode Keystore
env:
ENCODED_STRING: ${{ secrets.KEYSTORE_BASE_64 }}
shell: bash
run: |
echo $ENCODED_STRING > keystore-b64.txt
base64 -d <keystore-b64.txt >upload-keystore.jks
# The secrets.gradle file that is stored as text, does not need to be decoded
# and can be directly written to a file
# This file is used by the gradle build to sign the APK
- name: Create secrets.gradle
run: echo "${{ secrets.SECRETS_GRADLE }}" > secrets.gradle

- name: Build Prod Release Bundle
run: ./gradlew bundleProdRelease --stacktrace

- name: Upload Release Bundle to Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ github.run_number }}-prod-release-bundle
path: |
${{ github.workspace }}/app/build/outputs/bundle/prodRelease/app-prod-release.aab

- name: Upload to Play Store Internal Track
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_SERVICE_ACCOUNT_JSON }}
packageName: nl.q42.template # TODO: Update this to match your app's package name
releaseFiles: ${{ github.workspace }}/app/build/outputs/bundle/prodRelease/app-prod-release.aab
track: internal
status: completed
inAppUpdatePriority: 2
17 changes: 17 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ This project uses Github Actions for CI. We have added these workflows for now:

- _debug.yml_: any commit on any branch triggers a `devDebug` apk and a `prodDebug` apk build
- _release.yml_: any PR triggers signed release builds (`prodRelease` bundle and `prodRelease` apk)
- _firebase-app-distribution.yml_: any PR to develop triggers a release build that is uploaded to Firebase App Distribution
- _playstore-internal.yml_: any push to release branches (release/*) triggers a release build that is uploaded to Play Store Internal Test track

#### Adding your own keystore's details on Github Actions

Expand Down Expand Up @@ -124,6 +126,21 @@ With the default configuration, all commits on develop will be pushed to Firebas
To also make these available to a test group, you can enable the `groups` parameter in the
[firebase yml](.github/workflows/firebase-app-distribution.yml) file.

#### Play Store deployment

We use the [upload-google-play github action](https://github.com/r0adkll/upload-google-play) in our github actions setup to automatically upload release builds to the Play Store Internal Test track.

To enable this for your own app, you need to:

1. Create a service account in Google Cloud Console with access to the Google Play Developer API
2. Download the service account JSON key file
3. Add the content of the JSON file to your Github repository secrets as `PLAYSTORE_SERVICE_ACCOUNT_JSON`
4. Update the `packageName` in the [playstore-internal.yml](.github/workflows/playstore-internal.yml) file to match your app's package name

More details on creating a service account can be found in the [Google Play Android Developer API documentation](https://developers.google.com/android-publisher/getting_started).

With the default configuration, all commits to release branches (release/*) will be pushed to the Play Store Internal Test track.

#### Self-hosted runner

You can run the worlkflows on our self-hosted runner (a mac mini). This is:
Expand Down
Loading