[Automated workflow] upgrade-unity from 6000.5.3f1 to 6000.5.11f1 #1363
Workflow file for this run
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
| # Build and upload the project by pushing tags | ||
| name: Build project & release | ||
| on: | ||
| push: | ||
| tags: | ||
| - '*' | ||
| branches: | ||
| - master | ||
| jobs: | ||
| variables: | ||
| name: Define variables 🔗 | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| UNITY_VERSION: ${{ steps.set_unity_version.outputs.VERSION }} | ||
| TAG: ${{ steps.set_tag.outputs.VERSION }} | ||
| BUILD_NAME: ${{ steps.set_build_name.outputs.VERSION }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| sparse-checkout: | | ||
| ProjectSettings/ProjectVersion.txt | ||
| - name: Set unity version | ||
| id: set_unity_version | ||
| run: | | ||
| UNITY_VERSION=$(sed -n 's/^\m_EditorVersion: //p'< ./ProjectSettings/ProjectVersion.txt) | ||
| echo "VERSION=$UNITY_VERSION" >> $GITHUB_OUTPUT | ||
| - name: Set tag | ||
| id: set_tag | ||
| run: | | ||
| if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
| echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "VERSION=${{ steps.set_unity_version.outputs.VERSION }}-webgl2-master" >> $GITHUB_OUTPUT | ||
| fi | ||
| - name: Set target name | ||
| id: set_build_name | ||
| run: echo "VERSION=WebGL-${{ steps.set_tag.outputs.VERSION }}" >> $GITHUB_OUTPUT | ||
| - name: Log variables | ||
| run: | | ||
| echo "UNITY_VERSION -> ${{ steps.set_unity_version.outputs.VERSION }}" | ||
| echo "TAG -> ${{ steps.set_tag.outputs.VERSION }}" | ||
| echo "BUILD_NAME -> ${{ steps.set_build_name.outputs.VERSION }}" | ||
| tagVersionMatchTest: | ||
| needs: [ variables ] | ||
| name: Check tag version match ☑ | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Log tag and version | ||
| run: echo "Github tag '${{ needs.variables.outputs.TAG }}' has to start with unity version '${{ needs.variables.outputs.UNITY_VERSION }}'" | ||
| - name: Version match ✔ | ||
| if: startsWith(${{ needs.variables.outputs.TAG }}, {{ needs.variables.outputs.UNITY_VERSION }} | ||
|
Check warning on line 60 in .github/workflows/release.yml
|
||
| run: echo "Versions are matching 🥳" | ||
| - name: Version missmatch ❌ | ||
| if: ${{ !startsWith(needs.variables.outputs.TAG, needs.variables.outputs.UNITY_VERSION) }} | ||
| uses: actions/github-script@v4 | ||
| with: | ||
| script: | | ||
| core.setFailed('Unity version does not match tag version') | ||
| buildProject: | ||
| name: Create Unity WebGL Build 🏗 | ||
| # Build if it's a master push or if the tag is not just the unity version | ||
| if: ${{ github.ref == 'refs/heads/master' || needs.variables.outputs.TAG != needs.variables.outputs.UNITY_VERSION }} | ||
| needs: [ variables ] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| lfs: true | ||
| # Avoid running into space issues for github runners - Docker images can take up quite some space | ||
| - name: Free Disk Space | ||
| run: | | ||
| echo "Disk space before cleanup:" | ||
| df -h | ||
| sudo rm -rf /usr/share/dotnet | ||
| sudo rm -rf /opt/ghc | ||
| sudo rm -rf /usr/local/share/boost | ||
| sudo rm -rf "$AGENT_TOOLSDIRECTORY" | ||
| echo "Disk space after cleanup:" | ||
| df -h | ||
| # Unity 2020 cache is not compatible with older versions | ||
| - name: Unity Library Cache 2020 or higher | ||
| if: ${{ !startsWith(needs.variables.outputs.UNITY_VERSION, '201') }} | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: Library | ||
| key: Library-202x-WebGL | ||
| restore-keys: Library-202x- | ||
| - name: Unity Library Cache 2019 or lower | ||
| if: ${{ startsWith(needs.variables.outputs.UNITY_VERSION, '201') }} | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: Library | ||
| key: Library-201x-WebGL | ||
| restore-keys: Library-201x- | ||
| - name: Build project | ||
| id: buildStep | ||
| # Exit code 101 is recoverable and handled by the retry step below, so don't fail the job yet | ||
| continue-on-error: true | ||
| uses: game-ci/unity-builder@v4 | ||
| env: | ||
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | ||
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | ||
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | ||
| with: | ||
| buildMethod: UnityBuilderAction.BuildScript.BuildWithCommandlineArgs | ||
| customParameters: -tag ${{ needs.variables.outputs.TAG }} | ||
| targetPlatform: WebGL | ||
| versioning: None | ||
| buildName: ${{ needs.variables.outputs.BUILD_NAME }} | ||
| # Unity's Bee backend caps buildprogram planning runs at 6, but a cold WebGL minsize build | ||
| # needs 7, so the first attempt dies one node short of finishing (BuildScript exits with 101). | ||
| # Library/Bee is warm afterwards, which collapses the run chain, so a second build succeeds. | ||
| - name: Retry build after Bee buildprogram run limit | ||
| if: steps.buildStep.outputs.engineExitCode == '101' | ||
| uses: game-ci/unity-builder@v4 | ||
| env: | ||
| UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} | ||
| UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} | ||
| UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} | ||
| with: | ||
| buildMethod: UnityBuilderAction.BuildScript.BuildWithCommandlineArgs | ||
| customParameters: -tag ${{ needs.variables.outputs.TAG }} | ||
| targetPlatform: WebGL | ||
| versioning: None | ||
| buildName: ${{ needs.variables.outputs.BUILD_NAME }} | ||
| # Any other failure is not worth a second 15 minute build, so fail the job here | ||
| - name: Fail on unrecoverable build error | ||
| if: steps.buildStep.outcome == 'failure' && steps.buildStep.outputs.engineExitCode != '101' | ||
| run: | | ||
| echo "::error::Build failed with engineExitCode '${{ steps.buildStep.outputs.engineExitCode }}' - not retrying" | ||
| exit 1 | ||
| - name: Check Disk Space After Build | ||
| run: | | ||
| echo "Disk space after build:" | ||
| df -h | ||
| AVAILABLE=$(df / | tail -1 | awk '{print $4}') | ||
| AVAILABLE_GB=$(echo $AVAILABLE | sed 's/G//') | ||
| echo "Available space: ${AVAILABLE_GB}GB" | ||
| if (( $(echo "$AVAILABLE_GB < 1" | bc -l) )); then | ||
| echo "::warning::Low disk space! Less than 1GB remaining." | ||
| fi | ||
| - uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: ${{ needs.variables.outputs.BUILD_NAME }} | ||
| path: build/WebGL | ||
| createRelease: | ||
| name: Create Github release 🐙 | ||
| # only run for the pure tag without build parameters | ||
| if: ${{ github.ref_type == 'tag' && needs.variables.outputs.TAG == needs.variables.outputs.UNITY_VERSION }} | ||
| needs: [ variables ] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Create Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| body: | | ||
| ## Changes | ||
| * | ||
| [${{ needs.variables.outputs.UNITY_VERSION }}-webgl2](https://deml.io/experiments/unity-webgl/${{ needs.variables.outputs.UNITY_VERSION }}-webgl2/) | ||
| [${{ needs.variables.outputs.UNITY_VERSION }}-webgl1](https://deml.io/experiments/unity-webgl/${{ needs.variables.outputs.UNITY_VERSION }}-webgl1/) | ||
| [${{ needs.variables.outputs.UNITY_VERSION }}-urp-webgl2 Demo](https://deml.io/experiments/unity-webgl/${{ needs.variables.outputs.UNITY_VERSION }}-urp-webgl2/) | ||
| [${{ needs.variables.outputs.UNITY_VERSION }}-urp-webgl1 Demo](https://deml.io/experiments/unity-webgl/${{ needs.variables.outputs.UNITY_VERSION }}-urp-webgl1/) | ||
| [${{ needs.variables.outputs.UNITY_VERSION }}-minsize-webgl1 Demo](https://deml.io/experiments/unity-webgl/${{ needs.variables.outputs.UNITY_VERSION }}-minsize-webgl1/) | ||
| draft: true | ||
| deployOnServer: | ||
| name: Deploy on server 🚀 | ||
| needs: [ variables, buildProject ] | ||
| # Guarded by username, you will need to remove or replace the line for your fork | ||
| if: ${{ github.repository_owner == 'JohannesDeml' }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| name: ${{ needs.variables.outputs.BUILD_NAME }} | ||
| path: build | ||
| - name: Display structure of root files | ||
| run: ls -R | ||
| working-directory: build/${{ needs.variables.outputs.BUILD_NAME }} | ||
| - name: Deploy ⤴ | ||
| uses: SamKirkland/FTP-Deploy-Action@v4.3.5 | ||
| with: | ||
| server: ${{ secrets.FTP_SERVER }} | ||
| username: ${{ secrets.FTP_USER }} | ||
| password: ${{ secrets.FTP_PASSWORD }} | ||
| port: 21 | ||
| protocol: ftps | ||
| local-dir: ./build/${{ needs.variables.outputs.BUILD_NAME }}/ | ||
| server-dir: ./${{ needs.variables.outputs.TAG }}/ | ||
| # Make sure old files are deleted (e.g. created with name files as hashes) | ||
| dangerous-clean-slate: true | ||