Update unity.yml #12
This file contains 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
name: Unity | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
jobs: | |
build: | |
name: Build the unity project | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- uses: jlumbroso/free-disk-space@v1.3.1 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
# Cache | |
- uses: actions/cache@v3 | |
with: | |
path: Library | |
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
restore-keys: | | |
Library- | |
- name: Unity - Builder | |
# You may pin to the exact commit or the version. | |
# uses: game-ci/unity-builder@f4d2cceeb5831fd9dc4588d1b39d5f2dca8f28e6 | |
uses: game-ci/unity-builder@v4.2.1 | |
env: | |
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
with: | |
targetPlatform: Android | |
# buildName: build.aab # optional, default is | |
androidExportType: androidAppBundle # optional, default is androidPackage | |
androidKeystoreName: user.keystore # optional, default is | |
androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }} | |
androidKeystorePass: ${{ secrets.KEYSTORE_PASS }} # optional, default is | |
androidKeyaliasName: playstore key # optional, default is | |
androidKeyaliasPass: ${{ secrets.KEYALIAS_PASS }} # optional, default is | |
androidTargetSdkVersion: AndroidApiLevel33 | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: build-Android | |
path: build/Android | |
deploy: | |
name: Deploy on google play store | |
runs-on: ubuntu-latest | |
needs: build | |
if: ${{ github.event_name == 'push' }} | |
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 production' # Change to upload to a different lane | |
- name: Cleanup to avoid storage limit | |
if: always() | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: build-Android |