Skip to content

release-android-google-play #12

release-android-google-play

release-android-google-play #12

name: release-android-google-play
on:
workflow_dispatch:
inputs:
version:
description: 'GitHub Release'
required: true
type: string
play_release:
description: 'Release name from google play console'
required: true
type: string
# ToDo: adapt names
env:
# used for uploading the app to a GitHub release
GAME_EXECUTABLE_NAME: bevy_game
BUNDLE_PATH: "target/x/release/android/mobile.aab"
PACKAGE_NAME: "me.nikl.bevygame"
# release track; you can promote a build to "higher" tracks in the play console
TRACK: internal
permissions:
contents: write
jobs:
bundle-sign-release:
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Install Dependencies
run: sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev lld llvm
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
- name: Add Android targets
run: rustup target add aarch64-linux-android
- name: Install xbuild
run: cargo install --git https://github.com/NiklasEi/xbuild
- name: Build app bundle
run: |
cd mobile
x doctor
x build --release --platform android --store play
- name: sign app bundle
run: |
KEYSTORE_PATH=${{ runner.temp }}/upload-keystore.jks
echo -n "${{ secrets.PLAYSTORE_KEYSTORE }}" | base64 --decode > $KEYSTORE_PATH
jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 -keystore $KEYSTORE_PATH -storepass "${{ secrets.PLAYSTORE_KEYSTORE_PASSWORD }}" ${{ env.BUNDLE_PATH }} upload
- name: Upload self-signed bundle to GitHub
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.BUNDLE_PATH }}
asset_name: ${{ env.GAME_EXECUTABLE_NAME }}_${{ inputs.version }}_android.aab
release_name: ${{ inputs.version }}
tag: ${{ inputs.version }}
overwrite: true
- name: prepare Google play store secrets
run: |
SERVICE_ACCOUNT=${{ runner.temp }}/service-account.json
echo -n "${{ secrets.PLAYSTORE_SERVICE_ACCOUNT }}" | base64 --decode > $SERVICE_ACCOUNT
- name: upload bundle to Google play store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: ${{ runner.temp }}/service-account.json
packageName: ${{ env.PACKAGE_NAME }}
releaseName: ${{ inputs.play_release }}
releaseFiles: ${{ env.BUNDLE_PATH }}
track: ${{ env.TRACK }}