87 lines
2.5 KiB
YAML
87 lines
2.5 KiB
YAML
name: Actions 😎
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
build:
|
|
name: Build my project ✨
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
# Checkout (without LFS)
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
# Git LFS
|
|
- name: Create LFS file list
|
|
run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id
|
|
|
|
- name: Restore LFS cache
|
|
uses: actions/cache@v3
|
|
id: lfs-cache
|
|
with:
|
|
path: .git/lfs
|
|
key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }}
|
|
|
|
- name: Git LFS Pull
|
|
run: |
|
|
git lfs pull
|
|
git add .
|
|
git reset --hard
|
|
|
|
# Cache
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: Library
|
|
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
|
|
restore-keys: |
|
|
Library-
|
|
|
|
# Build
|
|
- name: Build project
|
|
uses: game-ci/unity-builder@v4
|
|
env:
|
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
with:
|
|
targetPlatform: Android
|
|
|
|
# Output
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: build-Android
|
|
path: build
|
|
releaseToGooglePlay:
|
|
name: Release to the Google Play Store
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
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
|
|
- 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 |