Skip to content

Instantly share code, notes, and snippets.

@AldeRoberge
Created June 20, 2024 05:27
Show Gist options
  • Save AldeRoberge/7743327e56ba7078109c2827c432dd81 to your computer and use it in GitHub Desktop.
Save AldeRoberge/7743327e56ba7078109c2827c432dd81 to your computer and use it in GitHub Desktop.
GameCI Build GitHub Actions for Android (fails after 50 minutes)
name: Build Game for Android and publish to Google Play
on:
push:
branches:
- main
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
jobs:
buildForAndroidPlatform:
name: Build For Android Platform
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: jlumbroso/free-disk-space@v1.3.1
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: Library
key: Library-Android
- uses: game-ci/unity-builder@v4
with:
projectPath: "AGX-Unity"
targetPlatform: Android
androidExportType: androidAppBundle
androidKeystoreName: user # This file won't exist, but this property needs to exist.
androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
androidKeystorePass: ${{ secrets.ANDROID_KEYSTORE_PASS }}
androidKeyaliasName: ${{ secrets.ANDROID_KEYALIAS_NAME }}
androidKeyaliasPass: ${{ secrets.ANDROID_KEYALIAS_PASS }}
androidTargetSdkVersion: AndroidApiLevel31 # Was 33, set it to 31 to see
- uses: actions/upload-artifact@v3
with:
name: build-Android
path: build/Android
releaseToGooglePlay:
name: Release to the Google Play Store
runs-on: ubuntu-latest
needs: buildForAndroidPlatform
env:
GOOGLE_PLAY_KEY_FILE: ${{ secrets.GOOGLE_PLAY_KEY_FILE }}
GOOGLE_PLAY_KEY_FILE_PATH:
${{ format('{0}/fastlane/google-fastlane.json', github.workspace) }}
ANDROID_BUILD_FILE_PATH: ${{ format('{0}/build/Android/Android.aab', github.workspace) }}
ANDROID_PACKAGE_NAME: ${{ secrets.ANDROID_PACKAGE_NAME }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download Android Artifact
uses: actions/download-artifact@v3
with:
name: build-Android
path: build/Android
- name: Add Authentication
run: echo "$GOOGLE_PLAY_KEY_FILE" > $GOOGLE_PLAY_KEY_FILE_PATH
- name: Set up Fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
bundler-cache: true
- name: Upload to Google Play Internal
uses: maierj/fastlane-action@v3.0.0
with:
lane: 'android internal' # Change to upload to a different lane
- name: Cleanup to avoid storage limit
if: always()
uses: geekyeggo/delete-artifact@v2
with:
name: build-Android
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment