Skip to content

Commit b2a9955

Browse files
committed
Merge branch 'master' into 2022.1
# Conflicts: # ProjectSettings/ProjectSettings.asset
2 parents f0820dd + 4f3e7fe commit b2a9955

34 files changed

+1327
-682
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## [Automated Workflow] Upgrade unity to {{ .unityversion }}
2+
3+
> [workflow file](https://github.com/JohannesDeml/UnityWebGL-LoadingTest/blob/master/.github/workflows/upgrade-unity.yml) using [create-pull-request](https://github.com/peter-evans/create-pull-request) & [render-template](https://github.com/chuhlomin/render-template)
4+
5+
### Built version demos
6+
7+
* https://deml.io/experiments/unity-webgl/{{ .unityversion }}-webgl2
8+
* https://deml.io/experiments/unity-webgl/{{ .unityversion }}-webgl1
9+
10+
### Other links
11+
12+
* [All builds](https://deml.io/experiments/unity-webgl)
13+
* [Game CI docker images](https://game.ci/docs/docker/versions)
14+
* [Unity Download Archive](https://unity.com/releases/editor/archive)

.github/workflows/release.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Build and upload the project by pushing tags
12
name: Build project & release
23

34
on:
@@ -73,11 +74,22 @@ jobs:
7374
fetch-depth: 0
7475
lfs: true
7576

76-
- uses: actions/cache@v3
77+
# Unity 2020 cache is not compatible with older versions
78+
- name: Unity Library Cache 2020 or higher
79+
if: ${{ !startsWith(needs.variables.outputs.UNITY_VERSION, '201') }}
80+
uses: actions/cache@v3
7781
with:
7882
path: Library
79-
key: Library-WebGL
80-
restore-keys: Library-
83+
key: Library-202x-WebGL
84+
restore-keys: Library-202x-
85+
86+
- name: Unity Library Cache 2019 or lower
87+
if: ${{ startsWith(needs.variables.outputs.UNITY_VERSION, '201') }}
88+
uses: actions/cache@v3
89+
with:
90+
path: Library
91+
key: Library-201x-WebGL
92+
restore-keys: Library-201x-
8193

8294
- name: Build project
8395
uses: game-ci/unity-builder@v2
@@ -119,7 +131,7 @@ jobs:
119131
deployOnServer:
120132
name: Deploy on server 🚀
121133
needs: [ variables, buildProject ]
122-
# Guarded by username, if you want to do something sinilar remove the next line
134+
# Guarded by username, you will need to remove or replace the line for your fork
123135
if: ${{ github.repository_owner == 'JohannesDeml' }}
124136
runs-on: ubuntu-latest
125137
steps:
@@ -136,12 +148,14 @@ jobs:
136148
working-directory: build/${{ needs.variables.outputs.BUILD_NAME }}
137149

138150
- name: Deploy ⤴
139-
uses: SamKirkland/FTP-Deploy-Action@4.2.0
151+
uses: SamKirkland/FTP-Deploy-Action@4.3.3
140152
with:
141153
server: ${{ secrets.FTP_SERVER }}
142154
username: ${{ secrets.FTP_USER }}
143155
password: ${{ secrets.FTP_PASSWORD }}
144156
port: 21
145157
protocol: ftps
146158
local-dir: ./build/${{ needs.variables.outputs.BUILD_NAME }}/
147-
server-dir: ./${{ needs.variables.outputs.TAG }}/
159+
server-dir: ./${{ needs.variables.outputs.TAG }}/
160+
# Make sure old files are deleted (e.g. created with name files as hashes)
161+
dangerous-clean-slate: true
Lines changed: 113 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Manually upgrade unity and update packages
2+
# Check if the Unity version already exists as a docker image: https://game.ci/docs/docker/versions
13
name: Upgrade Unity version
24

35
on:
@@ -7,11 +9,26 @@ on:
79
description: 'Unity Version'
810
required: true
911
type: string
12+
createTags:
13+
description: 'Create Tags'
14+
required: false
15+
type: boolean
16+
default: true
17+
urp:
18+
description: 'URP branch'
19+
required: true
20+
type: boolean
21+
default: false
22+
tagsOnly:
23+
description: 'Only create tags'
24+
required: true
25+
type: boolean
26+
default: false
1027
customParameters:
1128
description: 'Custom cli arguments'
1229
required: false
1330
type: string
14-
default: '-accept-apiupdate ‑ignorecompilererrors'
31+
default: '-accept-apiupdate'
1532

1633
jobs:
1734
upgrade-unity-version:
@@ -20,23 +37,69 @@ jobs:
2037
strategy:
2138
fail-fast: false
2239
steps:
23-
- run: |
40+
- name: Log input parameter
41+
run: |
2442
echo "Upgrading to Unity Version: $UNITY_VERSION"
43+
echo "Create tags: $CREATE_TAGS"
44+
echo "URP branch: $URP_BRANCH"
45+
echo "Custom cli arguments: $CUSTOM_PARAMETERS"
2546
env:
2647
UNITY_VERSION: ${{ inputs.unityVersion }}
48+
CREATE_TAGS: ${{ inputs.createTags }}
49+
URP_BRANCH: ${{ inputs.urp }}
50+
TAGS_ONLY: ${{ inputs.tagsOnly }}
51+
CUSTOM_PARAMETERS: ${{ inputs.customParameters }}
2752

2853
- uses: actions/checkout@v3
2954
with:
3055
fetch-depth: 0
3156
lfs: true
57+
# Makes sure, that pushing new tags will trigger workflows
58+
token: ${{ secrets.PR_GITHUB_TOKEN }}
59+
60+
# Unity 2020 cache is not compatible with older versions
61+
- name: Unity Library Cache 2020 or higher
62+
if: ${{ !startsWith(inputs.unityVersion, '201') }}
63+
uses: actions/cache@v3
64+
with:
65+
path: Library
66+
key: Library-202x-WebGL
67+
restore-keys: Library-202x-
3268

33-
- uses: actions/cache@v3
69+
- name: Unity Library Cache 2019 or lower
70+
if: ${{ startsWith(inputs.unityVersion, '201') }}
71+
uses: actions/cache@v3
3472
with:
3573
path: Library
36-
key: Library-WebGL
37-
restore-keys: Library-
74+
key: Library-201x-WebGL
75+
restore-keys: Library-201x-
76+
77+
- name: Set last unity version
78+
id: last_unity_version
79+
run: |
80+
LAST_UNITY_VERSION=$(sed -n 's/^\m_EditorVersion: //p'< ./ProjectSettings/ProjectVersion.txt)
81+
echo "VERSION=$LAST_UNITY_VERSION" >> $GITHUB_OUTPUT
82+
83+
- name: Set upgrade name
84+
id: upgrade_name
85+
run: |
86+
if [[ "$URP_BRANCH" == "true" ]]
87+
then
88+
echo "NAME=$UNITY_VERSION-urp" >> $GITHUB_OUTPUT
89+
else
90+
echo "NAME=$UNITY_VERSION" >> $GITHUB_OUTPUT
91+
fi
92+
env:
93+
UNITY_VERSION: ${{ inputs.unityVersion }}
94+
URP_BRANCH: ${{ inputs.urp }}
95+
96+
- name: Log variables
97+
run: |
98+
echo "last_unity_version -> ${{ steps.last_unity_version.outputs.VERSION }}"
99+
echo "upgrade_name -> ${{ steps.upgrade_name.outputs.NAME }}"
38100
39101
- name: Build project
102+
if: ${{ !inputs.tagsOnly }}
40103
uses: JohannesDeml/unity-builder@no-quit-parameter
41104
env:
42105
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
@@ -49,16 +112,56 @@ jobs:
49112
allowDirtyBuild: true
50113

51114
- name: Delete build folder with elevated rights
115+
if: ${{ !inputs.tagsOnly }}
52116
run: sudo rm -rf ./build
53117

54-
- name: Log git status
55-
run: git status
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+
126+
- name: Render template
127+
if: ${{ !inputs.tagsOnly }}
128+
id: template
129+
uses: chuhlomin/render-template@v1.4
130+
with:
131+
template: .github/templates/upgrade-unity-pr-body.md
132+
vars: |
133+
unityversion: ${{ steps.upgrade_name.outputs.NAME }}
56134
57135
- name: Create Pull Request
136+
if: ${{ !inputs.tagsOnly }}
58137
uses: peter-evans/create-pull-request@v4
59138
with:
60139
token: ${{ secrets.PR_GITHUB_TOKEN }}
61-
commit-message: "[Automated workflow] upgrade-unity to ${{ inputs.unityVersion }}"
62-
branch: "ci/upgrade-unity/${{ inputs.unityVersion }}"
140+
commit-message: "[Automated workflow] upgrade-unity from ${{steps.last_unity_version.outputs.VERSION}} to ${{ inputs.unityVersion }}"
141+
branch: "ci/upgrade-unity/from-${{steps.last_unity_version.outputs.VERSION}}-to-${{ steps.upgrade_name.outputs.NAME }}"
63142
delete-branch: true
64-
title: "[Automated Pull Request] upgrade-unity to ${{ inputs.unityVersion }}"
143+
title: "[Automated workflow] upgrade-unity from ${{steps.last_unity_version.outputs.VERSION}} to ${{ steps.upgrade_name.outputs.NAME }}"
144+
body: ${{ steps.template.outputs.result }}
145+
146+
- name: Add tags
147+
if: ${{ inputs.createTags || inputs.tagsOnly }}
148+
run: |
149+
if [[ "$URP_BRANCH" == "true" ]]
150+
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"
154+
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"
161+
fi
162+
163+
git push origin -f --tags
164+
env:
165+
UNITY_VERSION: ${{ inputs.unityVersion }}
166+
URP_BRANCH: ${{ inputs.urp }}
167+

.vscode/launch.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
// Needed for debugging with VS Code
3+
// Use IntelliSense to learn about possible attributes.
4+
// Hover to view descriptions of existing attributes.
5+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
6+
"version": "0.2.0",
7+
"configurations": [
8+
{
9+
"name": "Unity Editor",
10+
"type": "unity",
11+
"path": "${workspaceFolder}/Library/EditorInstance.json",
12+
"request": "launch"
13+
},
14+
{
15+
"name": "Windows Player",
16+
"type": "unity",
17+
"request": "launch"
18+
},
19+
{
20+
"name": "OSX Player",
21+
"type": "unity",
22+
"request": "launch"
23+
},
24+
{
25+
"name": "Linux Player",
26+
"type": "unity",
27+
"request": "launch"
28+
},
29+
{
30+
"name": "iOS Player",
31+
"type": "unity",
32+
"request": "launch"
33+
},
34+
{
35+
"name": "Android Player",
36+
"type": "unity",
37+
"request": "launch"
38+
},
39+
{
40+
"name": "Xbox One Player",
41+
"type": "unity",
42+
"request": "launch"
43+
},
44+
{
45+
"name": "PS4 Player",
46+
"type": "unity",
47+
"request": "launch"
48+
},
49+
{
50+
"name": "SwitchPlayer",
51+
"type": "unity",
52+
"request": "launch"
53+
}
54+
]
55+
}

.vscode/settings.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"files.exclude":
3+
{
4+
"**/.DS_Store":true,
5+
"**/.git":true,
6+
"**/.gitmodules":true,
7+
"**/*.pidb":true,
8+
"**/*.suo":true,
9+
"**/*.user":true,
10+
"**/*.userprefs":true,
11+
"**/*.unityproj":true,
12+
"**/*.meta":true,
13+
"Library/":true,
14+
"library/":true,
15+
"obj/":true,
16+
"Obj/":true,
17+
"temp/":true,
18+
"Temp/":true
19+
}
20+
}

.vscode/tasks.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "build",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"build",
10+
"${workspaceFolder}/Assembly-CSharp.csproj",
11+
"/property:GenerateFullPaths=true",
12+
"/consoleloggerparameters:NoSummary"
13+
],
14+
"problemMatcher": "$msCompile"
15+
},
16+
{
17+
"label": "publish",
18+
"command": "dotnet",
19+
"type": "process",
20+
"args": [
21+
"publish",
22+
"${workspaceFolder}/Assembly-CSharp.csproj",
23+
"/property:GenerateFullPaths=true",
24+
"/consoleloggerparameters:NoSummary"
25+
],
26+
"problemMatcher": "$msCompile"
27+
},
28+
{
29+
"label": "watch",
30+
"command": "dotnet",
31+
"type": "process",
32+
"args": [
33+
"watch",
34+
"run",
35+
"--project",
36+
"${workspaceFolder}/Assembly-CSharp.csproj"
37+
],
38+
"problemMatcher": "$msCompile"
39+
}
40+
]
41+
}

0 commit comments

Comments
 (0)