3232
3333jobs :
3434 upgrade-unity-version :
35- name : Upgrade Unity version and packages
35+ name : Upgrade Unity version and packages to ${{ inputs.unityVersion }}
3636 runs-on : ubuntu-latest
37- strategy :
38- fail-fast : false
3937 steps :
4038 - name : Log input parameter
4139 run : |
7573 env :
7674 GIT_USER : ${{ github.actor }}
7775
76+ # Avoid running into space issues for github runners - Docker images can take up quite some space
77+ - name : Free Disk Space
78+ run : |
79+ echo "Disk space before cleanup:"
80+ df -h
81+ sudo rm -rf /usr/share/dotnet
82+ sudo rm -rf /opt/ghc
83+ sudo rm -rf /usr/local/share/boost
84+ sudo rm -rf "$AGENT_TOOLSDIRECTORY"
85+ echo "Disk space after cleanup:"
86+ df -h
87+
7888 # Make sure the branch has the latest master changes in
7989 - name : Merge master into current branch
8090 if : ${{ inputs.mergeMaster }}
@@ -87,15 +97,15 @@ jobs:
8797 # Unity 2020 cache is not compatible with older versions
8898 - name : Unity Library Cache 2020 or higher
8999 if : ${{ !startsWith(inputs.unityVersion, '201') }}
90- uses : actions/cache@v3
100+ uses : actions/cache@v4
91101 with :
92102 path : Library
93103 key : Library-202x-WebGL
94104 restore-keys : Library-202x-
95105
96106 - name : Unity Library Cache 2019 or lower
97107 if : ${{ startsWith(inputs.unityVersion, '201') }}
98- uses : actions/cache@v3
108+ uses : actions/cache@v4
99109 with :
100110 path : Library
101111 key : Library-201x-WebGL
@@ -106,6 +116,13 @@ jobs:
106116 run : |
107117 LAST_UNITY_VERSION=$(sed -n 's/^\m_EditorVersion: //p'< ./ProjectSettings/ProjectVersion.txt)
108118 echo "VERSION=$LAST_UNITY_VERSION" >> $GITHUB_OUTPUT
119+ BRANCH_NAME=${GITHUB_REF#refs/heads/}
120+ if [[ "$BRANCH_NAME" == *"urp"* ]]
121+ then
122+ echo "NAME=$LAST_UNITY_VERSION-urp" >> $GITHUB_OUTPUT
123+ else
124+ echo "NAME=$LAST_UNITY_VERSION" >> $GITHUB_OUTPUT
125+ fi
109126
110127 - name : Set upgrade name
111128 id : upgrade_name
@@ -123,6 +140,7 @@ jobs:
123140 - name : Log variables
124141 run : |
125142 echo "last_unity_version -> ${{ steps.last_unity_version.outputs.VERSION }}"
143+ echo "last_unity_name -> ${{ steps.last_unity_version.outputs.NAME }}"
126144 echo "upgrade_name -> ${{ steps.upgrade_name.outputs.NAME }}"
127145
128146 - name : Build project
@@ -137,18 +155,30 @@ jobs:
137155 customParameters : ${{ inputs.customParameters }}
138156 unityVersion : ${{ inputs.unityVersion }}
139157 targetPlatform : WebGL
140- buildName : ${{ needs.variables .outputs.BUILD_NAME }}
158+ buildName : ${{ steps.upgrade_name .outputs.NAME }}
141159 allowDirtyBuild : true
142160 manualExit : true
143161
162+ - name : Check Disk Space After Build
163+ if : ${{ !inputs.tagsOnly }}
164+ run : |
165+ echo "Disk space after build:"
166+ df -h
167+ AVAILABLE=$(df / | tail -1 | awk '{print $4}')
168+ AVAILABLE_GB=$(echo $AVAILABLE | sed 's/G//')
169+ echo "Available space: ${AVAILABLE_GB}GB"
170+ if (( $(echo "$AVAILABLE_GB < 1" | bc -l) )); then
171+ echo "::warning::Low disk space! Less than 1GB remaining."
172+ fi
173+
144174 - name : Delete build folder with elevated rights
145175 if : ${{ !inputs.tagsOnly }}
146176 run : sudo rm -rf ./build
147177
148178 - name : Render template
149179 if : ${{ !inputs.tagsOnly }}
150180 id : template
151- uses : chuhlomin/render-template@v1.4
181+ uses : chuhlomin/render-template@v1.9
152182 with :
153183 template : .github/templates/upgrade-unity-pr-body.md
154184 vars : |
@@ -159,39 +189,24 @@ jobs:
159189 uses : peter-evans/create-pull-request@v4
160190 with :
161191 token : ${{ secrets.PR_GITHUB_TOKEN }}
162- commit-message : " [Automated workflow] upgrade-unity from ${{steps.last_unity_version.outputs.VERSION }} to ${{ inputs.unityVersion }}"
163- branch : " ci/upgrade-unity/from-${{steps.last_unity_version.outputs.VERSION }}-to-${{ steps.upgrade_name.outputs.NAME }}"
192+ commit-message : " [Automated workflow] upgrade-unity from ${{steps.last_unity_version.outputs.NAME }} to ${{ inputs.unityVersion }}"
193+ branch : " ci/upgrade-unity/from-${{steps.last_unity_version.outputs.NAME }}-to-${{ steps.upgrade_name.outputs.NAME }}"
164194 delete-branch : true
165- title : " [Automated workflow] upgrade-unity from ${{steps.last_unity_version.outputs.VERSION }} to ${{ steps.upgrade_name.outputs.NAME }}"
195+ title : " [Automated workflow] upgrade-unity from ${{steps.last_unity_version.outputs.NAME }} to ${{ steps.upgrade_name.outputs.NAME }}"
166196 body : ${{ steps.template.outputs.result }}
167197
168198 - name : Add tags
169199 if : ${{ inputs.createTags || inputs.tagsOnly }}
170200 run : |
171- # Extract the first four characters of UNITY_VERSION
172- UNITY_YEAR=${UNITY_VERSION:0:4}
173201 BRANCH_NAME=${GITHUB_REF#refs/heads/}
174202
175- TAG_PREFIX=$UNITY_VERSION
176- if [[ "$BRANCH_NAME" == *"urp"* ]]
177- then
178- TAG_PREFIX=$UNITY_VERSION-urp
203+ IS_URP=false
204+ if [[ "$BRANCH_NAME" == *"urp"* ]]; then
205+ IS_URP=true
179206 fi
180207
181- if [[ "$UNITY_YEAR" < "2023" ]]
182- then
183- git tag -a -f $TAG_PREFIX-minsize-webgl1 -m "[Automated workflow] Created by upgrade-unity"
184- git tag -a -f $TAG_PREFIX-webgl1 -m "[Automated workflow] Created by upgrade-unity"
185- else
186- git tag -a -f $TAG_PREFIX-minsize-webgl2 -m "[Automated workflow] Created by upgrade-unity"
187- fi
188- # Push tags in between - pushing more than 3 tags won't trigger tag workflows
189- git push origin -f --tags
190-
191- git tag -a -f $TAG_PREFIX-webgl2 -m "[Automated workflow] Created by upgrade-unity"
192- git tag -a -f $TAG_PREFIX-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
193-
194- git push origin -f --tags
208+ # Run add tags script
209+ ./.github/scripts/add-tags.sh "$UNITY_VERSION" "$IS_URP"
195210 env :
196211 UNITY_VERSION : ${{ inputs.unityVersion }}
197212
0 commit comments