Skip to content

Publish Released APK's to Google Playstore as draft #18

Publish Released APK's to Google Playstore as draft

Publish Released APK's to Google Playstore as draft #18

Workflow file for this run

# written in such a way that it is only need in obbimi/Squore create releases for all brands
name: Publish Released APK to Google
on:
workflow_dispatch: # run manually
inputs:
brand:
description: 'The brand to deploy: Squore/TennisPadel/Tabletennis/Badminton/Racketlon'
default: "Squore"
required: true
type: string
version:
description: 'The version to deploy: Last 3 digits of versionCode. A release named Release.${version} must exist and publicly accessible for the brand'
default: "526"
required: true
type: string
#releasePrefix:
# description: 'The prefix of the release that is published.'
# default: "Release."
# required: false
# type: string
jobs:
deploy:
runs-on: ubuntu-latest
#strategy:
# matrix:
# apkversion:
# - phoneTabletPost23
# - phoneTabletPre22
steps:
- name: Download from /releases
id: download_apk_extract_info
run: |
set -x
androidhome="${ANDROID_HOME:-${ANDROID_SDK}}"
aaptPath=$(find ${androidhome}/build-tools -name aapt | sort | tail -1)
version=${{ inputs.version }}
brand=${{ inputs.brand }}
releasePrefix=Release.
apkversions="phoneTabletPost23 phoneTabletPre22"
filenames=""
for apkversion in $apkversions; do
echo ${apkversion}
fn=${brand}.${version}-${apkversion}-release-signed.apk
filenames="${fn},${filenames}"
# download file
wget --quiet -O ${fn} https://github.com/obbimi/${brand}/releases/download/${releasePrefix}${version}/${fn}
# extract info from apk
PKG=$(${aaptPath} d badging ${fn} | grep pack | tr ' ' '\n' | grep -E ^name= | cut -d "'" -f 2)
echo "packageName=$PKG" >> $GITHUB_OUTPUT
done
echo "filenames=$filenames" | sed 's~,$~~' >> $GITHUB_OUTPUT
ls -l *.apk
# https://github.com/r0adkll/upload-google-play
- name: Publish to google play store
uses: r0adkll/[email protected]
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: ${{ steps.download_apk_extract_info.outputs.packageName }}
releaseFiles: ${{ steps.download_apk_extract_info.outputs.filenames }}
track: beta # alpha,beta,internal or production
releaseName: ${{ inputs.version }} # if not specified typically derived from versionCode/versionName
#changesNotSentForReview: true # does not seem to work or not allowed anymore by Google
# existingEditId: # A valid, unpublished Edit ID
status: draft
#inAppUpdatePriority: 2
#status: inProgress #Error: Status 'inProgress' requires a 'userFraction' to be set: One of completed, inProgress, halted, draft.
#userFraction: 0.10 # not possible in alpha
#whatsNewDirectory: distribution/whatsnew
#mappingFile: app/build/outputs/mapping/release/mapping.txt
#debugSymbols: app/intermediates/merged_native_libs/release/out/lib
# "Error: The first release on a track cannot be staged"
# Changes are sent for review automatically. The query parameter changesNotSentForReview must not be set.