update unity version #178
This file contains hidden or 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 WebGL Automatic Build 👽✨🚀 | |
| on: | |
| push: | |
| branches: | |
| - '1-configure-as-a-unity-package' | |
| pull_request: | |
| branches: | |
| - 'main' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| name: Unity Build 👽 | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout repository | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| with: | |
| token: ${{ secrets.PAT }} | |
| # 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@v2 | |
| id: lfs-cache | |
| with: | |
| path: .git/lfs | |
| key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} | |
| - name: Git LFS Pull | |
| run: | | |
| echo "Pulling LFS files..." | |
| git lfs pull | |
| git add . | |
| git reset --hard | |
| # Cache Unity Library | |
| - uses: actions/cache@v2 | |
| with: | |
| path: Library | |
| key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} | |
| restore-keys: | | |
| Library- | |
| # Unity Build | |
| - name: Build project | |
| uses: game-ci/unity-builder@v2 | |
| with: | |
| unityVersion: '2022.3.10f1' | |
| targetPlatform: WebGL | |
| buildsPath: CI-Output/WebGL | |
| allowDirtyBuild: true | |
| env: | |
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | |
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | |
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | |
| # Debug logs | |
| - name: Log build directory | |
| run: | | |
| echo "Build Directory Contents:" | |
| ls -la CI-Output/WebGL | |
| # Output: Artifact | |
| - name: Upload Build Artifact | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: WebGL-Build | |
| path: CI-Output/WebGL | |
| # Deployment | |
| - name: Deployment Preparation | |
| run: | | |
| echo "Preparing deployment..." | |
| git config --global user.email "${{ secrets.GH_EMAIL }}" | |
| git config --global user.name "${{ secrets.GH_USERNAME }}" | |
| sudo chown -R $USER:$USER CI-Output/WebGL | |
| - name: Cleaning gh-pages branch | |
| run: | | |
| echo "Switching to deployment branch..." | |
| git switch -f gh-pages | |
| git reset --hard | |
| sudo git clean -d -x -f | |
| rm -rf * | |
| git add * | |
| git commit -m "Cleaning branch for deployment" | |
| git push | |
| - name: Copy Build to gh-pages | |
| run: | | |
| echo "Copying build files to root..." | |
| cp -r CI-Output/WebGL/* . | |
| ls -la | |
| - name: Push Deployment | |
| run: | | |
| echo "Pushing to gh-pages branch..." | |
| git add . | |
| git commit -m "WebGL Deployment" | |
| git push |