Skip to content

Commit 21d03a4

Browse files
committed
Merge branch 'master' into 2022.1-urp
# Conflicts: # Assets/Scenes/Main.unity # Packages/manifest.json # Packages/packages-lock.json # ProjectSettings/ProjectSettings.asset # ProjectSettings/ProjectVersion.txt
2 parents 5ec594d + 093ef6d commit 21d03a4

38 files changed

+1303
-270
lines changed

.github/scripts/add-tags.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
# This script creates tags for the given unity version to trigger the release workflow
3+
# example usage
4+
# sh add-tags.sh "6000.0.0f1" -> Creates tags for non-urp version
5+
# sh add-tags.sh "6000.0.0f1" "true" -> Creates tags for urp version
6+
7+
# Input parameters
8+
UNITY_VERSION=$1
9+
IS_URP=${2:-"false"}
10+
echo "Running add_tags.sh with UNITY_VERSION: $UNITY_VERSION, IS_URP: $IS_URP"
11+
12+
# Extract the value before the first dot as an integer
13+
MAJOR_VERSION=$(echo $UNITY_VERSION | cut -d. -f1)
14+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
15+
16+
TAG_PREFIX=$UNITY_VERSION
17+
if [[ "$IS_URP" == "true" ]]
18+
then
19+
TAG_PREFIX=$UNITY_VERSION-urp
20+
fi
21+
22+
if [[ "$MAJOR_VERSION" -lt "2023" ]]
23+
then
24+
git tag -a -f $TAG_PREFIX-minsize-webgl1 -m "[Automated workflow] Created by upgrade-unity"
25+
git tag -a -f $TAG_PREFIX-webgl1 -m "[Automated workflow] Created by upgrade-unity"
26+
else
27+
git tag -a -f $TAG_PREFIX-minsize-webgl2 -m "[Automated workflow] Created by upgrade-unity"
28+
fi
29+
# Push tags in between - pushing more than 3 tags won't trigger tag workflows
30+
git push origin -f --tags
31+
32+
git tag -a -f $TAG_PREFIX-webgl2 -m "[Automated workflow] Created by upgrade-unity"
33+
git tag -a -f $TAG_PREFIX-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
34+
35+
if [[ "$MAJOR_VERSION" -ge "6000" ]]
36+
then
37+
git tag -a -f $TAG_PREFIX-webgpu -m "[Automated workflow] Created by upgrade-unity"
38+
fi
39+
40+
git push origin -f --tags

.github/templates/upgrade-unity-pr-body.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
### Built version demos
66

77
* https://deml.io/experiments/unity-webgl/{{ .unityversion }}-webgl2
8-
* https://deml.io/experiments/unity-webgl/{{ .unityversion }}-webgl1
8+
* https://deml.io/experiments/unity-webgl/{{ .unityversion }}-webgl2-debug
9+
* https://deml.io/experiments/unity-webgl/{{ .unityversion }}-minsize-webgl2
910

1011
### Other links
1112

.github/workflows/activation.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
push:
66
tags:
77
- '*'
8+
branches:
9+
- master
810

911
jobs:
1012
variables:
@@ -28,7 +30,12 @@ jobs:
2830
2931
- name: Set tag
3032
id: set_tag
31-
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
33+
run: |
34+
if [[ $GITHUB_REF == refs/tags/* ]]; then
35+
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
36+
else
37+
echo "VERSION=${{ steps.set_unity_version.outputs.VERSION }}-webgl2-master" >> $GITHUB_OUTPUT
38+
fi
3239
3340
- name: Set target name
3441
id: set_build_name
@@ -62,30 +69,40 @@ jobs:
6269
6370
buildProject:
6471
name: Create Unity WebGL Build 🏗
65-
# only build with additional parameters, the tag alone should only create a release draft
66-
if: ${{ needs.variables.outputs.TAG != needs.variables.outputs.UNITY_VERSION }}
72+
# Build if it's a master push or if the tag is not just the unity version
73+
if: ${{ github.ref == 'refs/heads/master' || needs.variables.outputs.TAG != needs.variables.outputs.UNITY_VERSION }}
6774
needs: [ variables ]
6875
runs-on: ubuntu-latest
69-
strategy:
70-
fail-fast: false
7176
steps:
7277
- uses: actions/checkout@v4
7378
with:
7479
fetch-depth: 0
7580
lfs: true
7681

82+
# Avoid running into space issues for github runners - Docker images can take up quite some space
83+
- name: Free Disk Space
84+
run: |
85+
echo "Disk space before cleanup:"
86+
df -h
87+
sudo rm -rf /usr/share/dotnet
88+
sudo rm -rf /opt/ghc
89+
sudo rm -rf /usr/local/share/boost
90+
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
91+
echo "Disk space after cleanup:"
92+
df -h
93+
7794
# Unity 2020 cache is not compatible with older versions
7895
- name: Unity Library Cache 2020 or higher
7996
if: ${{ !startsWith(needs.variables.outputs.UNITY_VERSION, '201') }}
80-
uses: actions/cache@v3
97+
uses: actions/cache@v4
8198
with:
8299
path: Library
83100
key: Library-202x-WebGL
84101
restore-keys: Library-202x-
85102

86103
- name: Unity Library Cache 2019 or lower
87104
if: ${{ startsWith(needs.variables.outputs.UNITY_VERSION, '201') }}
88-
uses: actions/cache@v3
105+
uses: actions/cache@v4
89106
with:
90107
path: Library
91108
key: Library-201x-WebGL
@@ -101,22 +118,34 @@ jobs:
101118
buildMethod: UnityBuilderAction.BuildScript.BuildWithCommandlineArgs
102119
customParameters: -tag ${{ needs.variables.outputs.TAG }}
103120
targetPlatform: WebGL
121+
versioning: None
104122
buildName: ${{ needs.variables.outputs.BUILD_NAME }}
105123

106-
- uses: actions/upload-artifact@v3
124+
- name: Check Disk Space After Build
125+
run: |
126+
echo "Disk space after build:"
127+
df -h
128+
AVAILABLE=$(df / | tail -1 | awk '{print $4}')
129+
AVAILABLE_GB=$(echo $AVAILABLE | sed 's/G//')
130+
echo "Available space: ${AVAILABLE_GB}GB"
131+
if (( $(echo "$AVAILABLE_GB < 1" | bc -l) )); then
132+
echo "::warning::Low disk space! Less than 1GB remaining."
133+
fi
134+
135+
- uses: actions/upload-artifact@v4
107136
with:
108137
name: ${{ needs.variables.outputs.BUILD_NAME }}
109138
path: build/WebGL
110139

111140
createRelease:
112141
name: Create Github release 🐙
113142
# only run for the pure tag without build parameters
114-
if: ${{ needs.variables.outputs.TAG == needs.variables.outputs.UNITY_VERSION }}
143+
if: ${{ github.ref_type == 'tag' && needs.variables.outputs.TAG == needs.variables.outputs.UNITY_VERSION }}
115144
needs: [ variables ]
116145
runs-on: ubuntu-latest
117146
steps:
118147
- name: Create Release
119-
uses: softprops/action-gh-release@v1
148+
uses: softprops/action-gh-release@v2
120149
with:
121150
body: |
122151
## Changes
@@ -140,7 +169,7 @@ jobs:
140169
- name: Checkout code
141170
uses: actions/checkout@v4
142171

143-
- uses: actions/download-artifact@v3
172+
- uses: actions/download-artifact@v4
144173
with:
145174
name: ${{ needs.variables.outputs.BUILD_NAME }}
146175
path: build
@@ -150,7 +179,7 @@ jobs:
150179
working-directory: build/${{ needs.variables.outputs.BUILD_NAME }}
151180

152181
- name: Deploy ⤴
153-
uses: SamKirkland/FTP-Deploy-Action@4.3.3
182+
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
154183
with:
155184
server: ${{ secrets.FTP_SERVER }}
156185
username: ${{ secrets.FTP_USER }}

.github/workflows/upgrade-unity.yml

Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,8 @@ on:
3232

3333
jobs:
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: |
@@ -75,6 +73,18 @@ jobs:
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

Comments
 (0)