Upload Tabletennis release latest assets to Play Store #59
This file contains hidden or 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
| # written in such a way that it is only needed in the obbimi/Squore repo to publish releases for Squore and all derivatives | |
| name: Upload apk's from a github release to Google Play Store as draft | |
| run-name: Upload ${{ inputs.brand }} release ${{ inputs.version }} assets to Play Store | |
| on: | |
| workflow_dispatch: # run manually | |
| inputs: | |
| brand: | |
| description: 'The brand to deploy: Squore/TennisPadel/Tabletennis/Badminton/Racketlon' | |
| default: "Squore" | |
| required: true | |
| type: choice | |
| options: | |
| - Badminton | |
| - Squore | |
| - Tabletennis | |
| - TennisPadel | |
| - Racketlon | |
| version: | |
| description: 'The version to deploy: Last 3 digits of versionCode. A release named ${version} must exist and publicly accessible for the brand' | |
| default: "latest" # TODO: use 'latest' or can this default automatically be updated on a commit containing build.gradle with a new value for versionCodeXXX | |
| 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: | |
| # - phoneTabletPost25 | |
| # - phoneTabletPre24 | |
| steps: | |
| - name: Download from /releases | |
| id: download_apk_extract_info | |
| run: | | |
| set -x | |
| version=${{ inputs.version }} | |
| brand=${{ inputs.brand }} | |
| if [[ "$version" == "latest" ]]; then | |
| version=$(curl -s -i https://github.com/obbimi/${brand}/releases/latest | grep -i location | cut -d '/' -f 8 | tr -d '\n' | tr -d '\r') | |
| fi | |
| echo "version=$version" >> $GITHUB_OUTPUT | |
| androidhome="${ANDROID_HOME:-${ANDROID_SDK}}" | |
| aaptPath=$(find ${androidhome}/build-tools -name aapt | sort | tail -1) | |
| # github contains a release for wearOs as well, but 1) google does not accept it for the moment, 2) should be in a different google release anyway | |
| apkversions="phoneTabletPost25 phoneTabletPre24" | |
| 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/${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 : ${{ steps.download_apk_extract_info.outputs.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" |