Files
tiennm99 793f00976e feat(ci): optional Play Store auto-publish on release tags
Adds a gated step in release.yml that uploads the signed AAB to the
Google Play Console internal track when PLAY_SERVICE_ACCOUNT_JSON is
configured. No-op if the secret is missing, so existing tag releases
keep working unchanged.

Default track is 'internal' for safety; change to alpha/beta/production
once trusted. Promotion can also be done via Play Console UI.

First Play Store upload must still be manual (Google policy).
2026-05-10 02:57:35 +07:00

81 lines
2.6 KiB
YAML

name: release
on:
push:
tags: ['v*.*.*']
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Node 22
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Install wrapper deps
run: npm ci
- name: Build loto + sync into Android
run: npm run build
- name: Decode keystore
run: echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > keystore.jks
- name: Build signed AAB + APK
working-directory: android
env:
LOTO_KEYSTORE_PATH: ${{ github.workspace }}/keystore.jks
LOTO_KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
LOTO_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
LOTO_KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: ./gradlew :app:bundleRelease :app:assembleRelease
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
android/app/build/outputs/apk/release/*.apk
android/app/build/outputs/bundle/release/*.aab
# Auto-publish to Google Play (gated on the service-account secret).
# Skips silently if PLAY_SERVICE_ACCOUNT_JSON is not configured, so
# tagging a release before Play setup still produces a GH Release.
# Default track is "internal" — change to alpha/beta/production
# once you trust the pipeline.
- name: Check Play Store config
id: play
run: |
if [ -n "${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}" ]; then
echo "configured=true" >> "$GITHUB_OUTPUT"
else
echo "configured=false" >> "$GITHUB_OUTPUT"
echo "::notice::PLAY_SERVICE_ACCOUNT_JSON not set; skipping Play Store upload."
fi
- name: Upload to Google Play (internal track)
if: steps.play.outputs.configured == 'true'
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
packageName: com.miti99.loto
releaseFiles: android/app/build/outputs/bundle/release/*.aab
track: internal
status: completed
# Bumps versionCode automatically? No — must be incremented
# manually in android/app/build.gradle before tagging.