66 workflow_dispatch :
77 inputs :
88 unityVersion :
9- description : ' Unity Version '
9+ description : ' Unity version '
1010 required : true
1111 type : string
1212 createTags :
1313 description : ' Create Tags'
1414 required : false
1515 type : boolean
1616 default : true
17- urp :
18- description : ' URP branch'
19- required : true
20- type : boolean
21- default : false
2217 tagsOnly :
2318 description : ' Only create tags'
2419 required : true
2520 type : boolean
2621 default : false
22+ mergeMaster :
23+ description : ' Merge master into branch'
24+ required : true
25+ type : boolean
26+ default : true
2727 customParameters :
2828 description : ' Custom cli arguments'
2929 required : false
@@ -39,24 +39,51 @@ jobs:
3939 steps :
4040 - name : Log input parameter
4141 run : |
42- echo "Upgrading to Unity Version: $UNITY_VERSION"
42+ BRANCH_NAME=${GITHUB_REF#refs/heads/}
43+
44+ echo "Branch: $BRANCH_NAME"
45+ echo "Unity version: $UNITY_VERSION"
4346 echo "Create tags: $CREATE_TAGS"
44- echo "URP branch: $URP_BRANCH"
47+ echo "Only create tags: $TAGS_ONLY"
48+ echo "Merge master into branch: $MERGE_MASTER"
4549 echo "Custom cli arguments: $CUSTOM_PARAMETERS"
50+ if [[ "$BRANCH_NAME" == *"urp"* ]]
51+ then
52+ echo "urp: true"
53+ else
54+ echo "urp: false"
55+ fi
4656 env :
4757 UNITY_VERSION : ${{ inputs.unityVersion }}
4858 CREATE_TAGS : ${{ inputs.createTags }}
49- URP_BRANCH : ${{ inputs.urp }}
5059 TAGS_ONLY : ${{ inputs.tagsOnly }}
60+ MERGE_MASTER : ${{ inputs.mergeMaster }}
5161 CUSTOM_PARAMETERS : ${{ inputs.customParameters }}
5262
53- - uses : actions/checkout@v3
63+ - uses : actions/checkout@v4
5464 with :
5565 fetch-depth : 0
5666 lfs : true
5767 # Makes sure, that pushing new tags will trigger workflows
5868 token : ${{ secrets.PR_GITHUB_TOKEN }}
5969
70+ - name : Set git user
71+ run : |
72+ git status
73+ git config --global user.email "$GIT_USER@users.noreply.github.com"
74+ git config --global user.name "$GIT_USER"
75+ env :
76+ GIT_USER : ${{ github.actor }}
77+
78+ # Make sure the branch has the latest master changes in
79+ - name : Merge master into current branch
80+ if : ${{ inputs.mergeMaster }}
81+ run : |
82+ git fetch origin master
83+ git merge FETCH_HEAD
84+ git push
85+ git log -1
86+
6087 # Unity 2020 cache is not compatible with older versions
6188 - name : Unity Library Cache 2020 or higher
6289 if : ${{ !startsWith(inputs.unityVersion, '201') }}
@@ -83,15 +110,15 @@ jobs:
83110 - name : Set upgrade name
84111 id : upgrade_name
85112 run : |
86- if [[ "$URP_BRANCH" == "true" ]]
113+ BRANCH_NAME=${GITHUB_REF#refs/heads/}
114+ if [[ "$BRANCH_NAME" == *"urp"* ]]
87115 then
88116 echo "NAME=$UNITY_VERSION-urp" >> $GITHUB_OUTPUT
89117 else
90118 echo "NAME=$UNITY_VERSION" >> $GITHUB_OUTPUT
91119 fi
92120 env :
93121 UNITY_VERSION : ${{ inputs.unityVersion }}
94- URP_BRANCH : ${{ inputs.urp }}
95122
96123 - name : Log variables
97124 run : |
@@ -100,29 +127,24 @@ jobs:
100127
101128 - name : Build project
102129 if : ${{ !inputs.tagsOnly }}
103- uses : JohannesDeml /unity-builder@no-quit-parameter
130+ uses : game-ci /unity-builder@v4
104131 env :
105132 UNITY_LICENSE : ${{ secrets.UNITY_LICENSE }}
133+ UNITY_EMAIL : ${{ secrets.UNITY_EMAIL }}
134+ UNITY_PASSWORD : ${{ secrets.UNITY_PASSWORD }}
106135 with :
107136 buildMethod : UnityBuilderAction.UnityPackageScripts.UpgradeAllPackagesToVerifiedVersion
108137 customParameters : ${{ inputs.customParameters }}
109138 unityVersion : ${{ inputs.unityVersion }}
110139 targetPlatform : WebGL
111140 buildName : ${{ needs.variables.outputs.BUILD_NAME }}
112141 allowDirtyBuild : true
142+ manualExit : true
113143
114144 - name : Delete build folder with elevated rights
115145 if : ${{ !inputs.tagsOnly }}
116146 run : sudo rm -rf ./build
117147
118- - name : Set git user
119- run : |
120- git status
121- git config --global user.email "$GIT_USER@users.noreply.github.com"
122- git config --global user.name "$GIT_USER"
123- env :
124- GIT_USER : ${{ github.actor }}
125-
126148 - name : Render template
127149 if : ${{ !inputs.tagsOnly }}
128150 id : template
@@ -146,22 +168,30 @@ jobs:
146168 - name : Add tags
147169 if : ${{ inputs.createTags || inputs.tagsOnly }}
148170 run : |
149- if [[ "$URP_BRANCH" == "true" ]]
171+ # Extract the first four characters of UNITY_VERSION
172+ UNITY_YEAR=${UNITY_VERSION:0:4}
173+ BRANCH_NAME=${GITHUB_REF#refs/heads/}
174+
175+ TAG_PREFIX=$UNITY_VERSION
176+ if [[ "$BRANCH_NAME" == *"urp"* ]]
177+ then
178+ TAG_PREFIX=$UNITY_VERSION-urp
179+ fi
180+
181+ if [[ "$UNITY_YEAR" < "2023" ]]
150182 then
151- git tag -a -f $UNITY_VERSION-urp-webgl1 -m "[Automated workflow] Created by upgrade-unity"
152- git tag -a -f $UNITY_VERSION-urp-webgl2 -m "[Automated workflow] Created by upgrade-unity"
153- git tag -a -f $UNITY_VERSION-urp-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
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"
154185 else
155- git tag -a -f $UNITY_VERSION-minsize-webgl1 -m "[Automated workflow] Created by upgrade-unity"
156- git tag -a -f $UNITY_VERSION-webgl1 -m "[Automated workflow] Created by upgrade-unity"
157- git tag -a -f $UNITY_VERSION-webgl2 -m "[Automated workflow] Created by upgrade-unity"
158- # Push tags in between - pushing more than 3 tags won't trigger tag workflows
159- git push origin -f --tags
160- git tag -a -f $UNITY_VERSION-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
186+ git tag -a -f $TAG_PREFIX-minsize-webgl2 -m "[Automated workflow] Created by upgrade-unity"
161187 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"
162193
163194 git push origin -f --tags
164195 env :
165196 UNITY_VERSION : ${{ inputs.unityVersion }}
166- URP_BRANCH : ${{ inputs.urp }}
167197
0 commit comments