Publish App to Play Store #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish App to Play Store | |
# This workflow is triggered on a schedule or when specific tags are pushed. | |
# It runs every Monday at 12:00 UTC and also when the 'internal_testing' tag is pushed. | |
on: | |
schedule: | |
- cron: '0 12 * * 1' # Runs every Monday at 12:00 | |
push: | |
tags: | |
- 'internal_testing' # internal_testing Tag | |
jobs: | |
publish: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
- name: Retrieve secrets to files | |
env: | |
KEYSTORE: ${{ secrets.keystore }} | |
PLAYSTORE_JSON: ${{ secrets.PLAYSTORE_JSON }} | |
run: | | |
echo "$KEYSTORE" | base64 -d > kiwix-android.keystore | |
echo "$PLAYSTORE_JSON" > playstore.json | |
- name: Retrieve date from git revision | |
id: git_head_revision_date | |
run: | | |
DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d) | |
echo "KIWIX_ANDROID_RELEASE_DATE=$DATE" >> $GITHUB_ENV | |
shell: bash | |
- name: Publish bundle in internal testing on Google Play | |
env: | |
KEY_ALIAS: ${{ secrets.KEY_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }} | |
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }} | |
KIWIX_ANDROID_RELEASE_DATE: ${{ env.KIWIX_ANDROID_RELEASE_DATE }} | |
run: | | |
OUTPUT=$(./gradlew publishPlayStoreBundle --scan 2>&1) | |
echo "$OUTPUT" > gradle_output.log | |
if echo "$OUTPUT" | grep -q "BUILD SUCCESSFUL"; then | |
echo "$OUTPUT" | |
exit 0 | |
fi | |
if echo "$OUTPUT" | grep -q "Try another version code."; then | |
echo "Upload skipped because very same version. $OUTPUT" | |
exit 0 | |
fi | |
echo "$OUTPUT" | |
exit 1 |