Skip to content

version 4.1.5

version 4.1.5 #147

# SPDX-FileCopyrightText: 2023 Simon Dalvai <info@simondalvai.org>
# SPDX-License-Identifier: CC0-1.0
name: Android upload
on:
push:
paths:
- "version"
- ".github/workflows/upload-android.yml"
- "fdroid/*"
- "export_presets.android.example"
- "metadata/*"
env:
WORKING_DIRECTORY: game
ANDROID_SERVICE_ACCOUNT_JSON: ${{ secrets.ANDROID_SERVICE_ACCOUNT_JSON }}
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }}
ANDROID_STORE_PASSWORD: ${{ secrets.ANDROID_STORE_PASSWORD }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEYSTORE_DEBUG_BASE64: ${{ secrets.ANDROID_KEYSTORE_DEBUG_BASE64 }}
jobs:
deploy:
if: github.ref == 'refs/heads/prod'
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v3
- name: Read version number and version code
run: |
echo "VERSION_NAME=$(cat version | cut -f1 -d-)" >> $GITHUB_ENV
echo "VERSION_CODE=$(cat version | cut -f2 -d-)" >> $GITHUB_ENV
- name: F-Droid check if changelog exists
run: test -f "metadata/en-US/changelogs/$VERSION_CODE.txt"
- name: F-Droid check if versions are correct in fdroid/export_presets.cfg
run: |
grep -Fxq "version/code=$VERSION_CODE" fdroid/export_presets.cfg
grep -Fxq "version/name=\"$VERSION_NAME\"" fdroid/export_presets.cfg
- name: Create changelog text for Github releases
id: changelog
run: |
r=$(cat metadata/en-US/changelogs/$VERSION_CODE.txt)
r="${r//'%'/'%25'}" # Multiline escape sequences for %
r="${r//$'\n'/'%0A'}" # Multiline escape sequences for '\n'
r="${r//$'\r'/'%0D'}" # Multiline escape sequences for '\r'
echo "RELEASE_BODY=$r" >> $GITHUB_OUTPUT
- name: Create changelog text for Google Play Store
run: |
mkdir -p distribution/whatsnew
cp metadata/en-US/changelogs/$VERSION_CODE.txt distribution/whatsnew/whatsnew-en-US
- name: Create service-account.json
run: echo $ANDROID_SERVICE_ACCOUNT_JSON > service-account.json
- name: Create keystores
run: |
echo $ANDROID_KEYSTORE_BASE64 | base64 --decode > keystore.keystore
echo $ANDROID_KEYSTORE_DEBUG_BASE64 | base64 --decode > debug.keystore
- name: Create export_presets.cfg and inject values
run: |
cp game/export_presets.android.example game/export_presets.cfg
sed -i "s|VERSION_CODE|$VERSION_CODE|g" $WORKING_DIRECTORY/export_presets.cfg
sed -i "s|VERSION_NAME|$VERSION_NAME|g" $WORKING_DIRECTORY/export_presets.cfg
sed -i "s|KEYSTORE_RELEASE_PATH|$GITHUB_WORKSPACE/keystore.keystore|g" $WORKING_DIRECTORY/export_presets.cfg
sed -i "s|KEYSTORE_DEBUG_PATH|$GITHUB_WORKSPACE/debug.keystore|g" $WORKING_DIRECTORY/export_presets.cfg
sed -i "s|ANDROID_KEYSTORE_ALIAS|$ANDROID_KEYSTORE_ALIAS|g" $WORKING_DIRECTORY/export_presets.cfg
sed -i "s|ANDROID_KEYSTORE_PASSWORD|$ANDROID_KEYSTORE_PASSWORD|g" $WORKING_DIRECTORY/export_presets.cfg
- name: Delete iOS icons
run: rm -rf $WORKING_DIRECTORY/AppIcons
# GODOT EXPORT
- name: Godot Android export
uses: dulvui/godot-android-export@v3
with:
godot-version: 3.6
working-directory: $WORKING_DIRECTORY
# GOOGLE PLAY STORE
- name: Publish to Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJson: service-account.json
packageName: com.salvai.ultimatetoss
releaseFiles: Ball2Box.aab
whatsNewDirectory: distribution/whatsnew
track: 'internal'
status: completed
# GITHUB RELEASES
- name: Bundle aab to apk
run: |
wget -q https://github.com/google/bundletool/releases/download/1.14.0/bundletool-all-1.14.0.jar
java -jar bundletool-all-1.14.0.jar build-apks --bundle=Ball2Box.aab --output=Ball2Box.apks \
--ks=keystore.keystore --ks-pass=pass:"$ANDROID_STORE_PASSWORD" --ks-key-alias="$ANDROID_KEYSTORE_ALIAS" \
--key-pass=pass:"$ANDROID_KEYSTORE_PASSWORD" --mode=universal
unzip -p Ball2Box.apks universal.apk > Ball2Box.apk
- name: Upload binaries to Github release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./Ball2Box.apk
asset_name: Ball2Box.apk
tag: v${{ env.VERSION_NAME }}
overwrite: true
body: ${{ steps.changelog.outputs.RELEASE_BODY }}