Skip to content

Commit

Permalink
feat: workflow to cache unity for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantotone committed Aug 14, 2023
1 parent d75ee06 commit a6d7c94
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/cache-unity-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Cache Unity 2021.3.21f1 for Windows

on:
workflow_dispatch:

env:
unityVersion: "2021.3.21f1"
unityVersionHash: "1b156197d683"

jobs:
cacheUnity:
name: Cache Unity 2021.3.21f1 for Windows
runs-on: windows-2019
timeout-minutes: 90

steps:
- name: "Get Unity Editor + Windows IL2CPP builder (${{ env.unityVersion }}) pre-installed from cache"
id: unity-install
uses: actions/[email protected]
with:
path: ${{ runner.temp }}/Unity
key: windows-unity-${{ env.unityVersion }}

- if: ${{ steps.unity-install.outputs.cache-hit != 'true' }}
name: "Download Unity Editor + Windows IL2CPP builder"
continue-on-error: true
run: >
mkdir ${{ runner.temp }}\UnityInstall;
curl -L -o "${{ runner.temp }}\UnityInstall\UnitySetup64-${{ env.unityVersion }}.exe" https://download.unity3d.com/download_unity/${{ env.unityVersionHash }}/Windows64EditorInstaller/UnitySetup64-${{ env.unityVersion }}.exe;
curl -L -o "${{ runner.temp }}\UnityInstall\UnitySetup-Windows-IL2CPP-Support-for-Editor-${{ env.unityVersion }}.exe" https://download.unity3d.com/download_unity/${{ env.unityVersionHash }}/TargetSupportInstaller/UnitySetup-Windows-IL2CPP-Support-for-Editor-${{ env.unityVersion }}.exe;
- if: ${{ steps.unity-install.outputs.cache-hit != 'true' }}
name: "Install Unity"
run: >
$UNITY_INSTALLARGUMENTS = "/S /D=${{ runner.temp }}\\Unity";
Start-Process "${{ runner.temp }}\UnityInstall\UnitySetup64-${{ env.unityVersion }}.exe" -ArgumentList $UNITY_INSTALLARGUMENTS -wait -nonewwindow;
Start-Process "${{ runner.temp }}\UnityInstall\UnitySetup-Windows-IL2CPP-Support-for-Editor-${{ env.unityVersion }}.exe" -ArgumentList $UNITY_INSTALLARGUMENTS -wait -nonewwindow;
Remove-Item -Recurse -Force -Path ${{ runner.temp }}\UnityInstall\*;

0 comments on commit a6d7c94

Please sign in to comment.