Skip to content

Commit 699dd3a

Browse files
authored
Merge pull request #5 from IvanMurzak/feature/installer
Added Installer
2 parents e9976d8 + 1bef777 commit 699dd3a

File tree

180 files changed

+5725
-681
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+5725
-681
lines changed

.github/workflows/release.yml

Lines changed: 379 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,379 @@
1+
name: release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
setup:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
UnityProjectPath: ${{ steps.vars.outputs.UnityProjectPath }}
13+
UnityPackageRoot: ${{ steps.vars.outputs.UnityPackageRoot }}
14+
InstallerProjectPath: ${{ steps.vars.outputs.InstallerProjectPath }}
15+
InstallerFileName: ${{ steps.vars.outputs.InstallerFileName }}
16+
InstallerExportMethod: ${{ steps.vars.outputs.InstallerExportMethod }}
17+
InstallerUnityVersion: ${{ steps.vars.outputs.InstallerUnityVersion }}
18+
steps:
19+
- id: vars
20+
run: |
21+
echo "UnityProjectPath=./Unity-Package" >> $GITHUB_OUTPUT
22+
echo "UnityPackageRoot=./Assets/root" >> $GITHUB_OUTPUT
23+
echo "InstallerProjectPath=./Installer" >> $GITHUB_OUTPUT
24+
echo "InstallerFileName=Gyroscope-Parallax-Installer" >> $GITHUB_OUTPUT
25+
echo "InstallerExportMethod=com.IvanMurzak.Unity.Gyroscope.Parallax.Installer.PackageExporter.ExportPackage" >> $GITHUB_OUTPUT
26+
echo "InstallerUnityVersion=2020.3.36f1" >> $GITHUB_OUTPUT
27+
28+
check-version-tag:
29+
needs: setup
30+
runs-on: ubuntu-latest
31+
outputs:
32+
version: ${{ steps.get_version.outputs.current-version }}
33+
prev_tag: ${{ steps.prev_tag.outputs.tag }}
34+
tag_exists: ${{ steps.tag_exists.outputs.exists }}
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
fetch-tags: true
41+
42+
- name: Get version from package.json
43+
id: get_version
44+
uses: martinbeentjes/npm-get-version-action@v1.3.1
45+
with:
46+
path: ${{ needs.setup.outputs.UnityProjectPath }}/${{ needs.setup.outputs.UnityPackageRoot }}
47+
48+
- name: Find previous version tag
49+
id: prev_tag
50+
uses: WyriHaximus/github-action-get-previous-tag@v1
51+
52+
- name: Check if tag exists
53+
id: tag_exists
54+
uses: mukunku/tag-exists-action@v1.6.0
55+
with:
56+
tag: ${{ steps.get_version.outputs.current-version }}
57+
58+
build-unity-installer:
59+
runs-on: [ubuntu-latest]
60+
needs: [setup, check-version-tag]
61+
if: needs.check-version-tag.outputs.tag_exists == 'false'
62+
steps:
63+
- name: Checkout repository
64+
uses: actions/checkout@v4
65+
66+
- name: Cache Unity Library
67+
uses: actions/cache@v4
68+
with:
69+
path: ${{ needs.setup.outputs.InstallerProjectPath }}/Library
70+
key: Library-Unity-Installer
71+
72+
- name: Test Unity Installer (EditMode)
73+
uses: game-ci/unity-test-runner@v4
74+
env:
75+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
76+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
77+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
78+
with:
79+
projectPath: ${{ needs.setup.outputs.InstallerProjectPath }}
80+
unityVersion: ${{ needs.setup.outputs.InstallerUnityVersion }}
81+
customImage: 'unityci/editor:ubuntu-${{ needs.setup.outputs.InstallerUnityVersion }}-base-3'
82+
testMode: editmode
83+
githubToken: ${{ secrets.GITHUB_TOKEN }}
84+
checkName: Unity Installer EditMode Test Results
85+
artifactsPath: artifacts-installer-editmode
86+
customParameters: -CI true -GITHUB_ACTIONS true
87+
88+
- name: Clean Unity artifacts and reset git state
89+
run: |
90+
# Force remove Unity generated files with restricted permissions
91+
sudo rm -rf ${{ needs.setup.outputs.InstallerProjectPath }}/Logs/ || true
92+
sudo rm -rf ${{ needs.setup.outputs.InstallerProjectPath }}/Temp/ || true
93+
sudo rm -rf ./artifacts-installer-editmode/ || true
94+
95+
# Reset only tracked files to their committed state
96+
git reset --hard HEAD
97+
echo "Cleaned Unity artifacts and reset tracked files"
98+
99+
- name: Export Unity Package
100+
uses: game-ci/unity-builder@v4
101+
env:
102+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
103+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
104+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
105+
with:
106+
projectPath: ${{ needs.setup.outputs.InstallerProjectPath }}
107+
unityVersion: ${{ needs.setup.outputs.InstallerUnityVersion }}
108+
customImage: 'unityci/editor:ubuntu-${{ needs.setup.outputs.InstallerUnityVersion }}-base-3'
109+
buildName: ${{ needs.setup.outputs.InstallerFileName }}
110+
buildsPath: build
111+
buildMethod: ${{ needs.setup.outputs.InstallerExportMethod }}
112+
customParameters: -CI true -GITHUB_ACTIONS true
113+
114+
- name: Upload Unity Package as artifact
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: unity-installer-package
118+
path: ${{ needs.setup.outputs.InstallerProjectPath }}/build/${{ needs.setup.outputs.InstallerFileName }}.unitypackage
119+
120+
# --- UNITY TESTS ---
121+
# -------------------
122+
123+
# --- EDIT MODE ---
124+
125+
test-unity-2019-4-40f1-editmode:
126+
needs: [setup, build-unity-installer]
127+
uses: ./.github/workflows/test_unity_plugin.yml
128+
with:
129+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
130+
unityVersion: '2019.4.40f1'
131+
testMode: 'editmode'
132+
secrets: inherit
133+
134+
test-unity-2020-3-48f1-editmode:
135+
needs: [setup, build-unity-installer]
136+
uses: ./.github/workflows/test_unity_plugin.yml
137+
with:
138+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
139+
unityVersion: '2020.3.48f1'
140+
testMode: 'editmode'
141+
secrets: inherit
142+
143+
test-unity-2021-3-45f1-editmode:
144+
needs: [setup, build-unity-installer]
145+
uses: ./.github/workflows/test_unity_plugin.yml
146+
with:
147+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
148+
unityVersion: '2021.3.45f1'
149+
testMode: 'editmode'
150+
secrets: inherit
151+
152+
test-unity-2022-3-62f1-editmode:
153+
needs: [setup, build-unity-installer]
154+
uses: ./.github/workflows/test_unity_plugin.yml
155+
with:
156+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
157+
unityVersion: '2022.3.62f1'
158+
testMode: 'editmode'
159+
secrets: inherit
160+
161+
test-unity-6000-0-58f1-editmode:
162+
needs: [setup, build-unity-installer]
163+
uses: ./.github/workflows/test_unity_plugin.yml
164+
with:
165+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
166+
unityVersion: '6000.0.58f1'
167+
testMode: 'editmode'
168+
secrets: inherit
169+
170+
# --- PLAY MODE ---
171+
172+
test-unity-2019-4-40f1-playmode:
173+
needs: [setup, build-unity-installer]
174+
uses: ./.github/workflows/test_unity_plugin.yml
175+
with:
176+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
177+
unityVersion: '2019.4.40f1'
178+
testMode: 'playmode'
179+
secrets: inherit
180+
181+
test-unity-2020-3-48f1-playmode:
182+
needs: [setup, build-unity-installer]
183+
uses: ./.github/workflows/test_unity_plugin.yml
184+
with:
185+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
186+
unityVersion: '2020.3.48f1'
187+
testMode: 'playmode'
188+
secrets: inherit
189+
190+
test-unity-2021-3-45f1-playmode:
191+
needs: [setup, build-unity-installer]
192+
uses: ./.github/workflows/test_unity_plugin.yml
193+
with:
194+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
195+
unityVersion: '2021.3.45f1'
196+
testMode: 'playmode'
197+
secrets: inherit
198+
199+
test-unity-2022-3-62f1-playmode:
200+
needs: [setup, build-unity-installer]
201+
uses: ./.github/workflows/test_unity_plugin.yml
202+
with:
203+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
204+
unityVersion: '2022.3.62f1'
205+
testMode: 'playmode'
206+
secrets: inherit
207+
208+
test-unity-6000-0-58f1-playmode:
209+
needs: [setup, build-unity-installer]
210+
uses: ./.github/workflows/test_unity_plugin.yml
211+
with:
212+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
213+
unityVersion: '6000.0.58f1'
214+
testMode: 'playmode'
215+
secrets: inherit
216+
217+
# --- STANDALONE ---
218+
219+
test-unity-2019-4-40f1-standalone:
220+
needs: [setup, build-unity-installer]
221+
uses: ./.github/workflows/test_unity_plugin.yml
222+
with:
223+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
224+
unityVersion: '2019.4.40f1'
225+
testMode: 'standalone'
226+
secrets: inherit
227+
228+
test-unity-2020-3-48f1-standalone:
229+
needs: [setup, build-unity-installer]
230+
uses: ./.github/workflows/test_unity_plugin.yml
231+
with:
232+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
233+
unityVersion: '2020.3.48f1'
234+
testMode: 'standalone'
235+
secrets: inherit
236+
237+
test-unity-2021-3-45f1-standalone:
238+
needs: [setup, build-unity-installer]
239+
uses: ./.github/workflows/test_unity_plugin.yml
240+
with:
241+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
242+
unityVersion: '2021.3.45f1'
243+
testMode: 'standalone'
244+
secrets: inherit
245+
246+
test-unity-2022-3-62f1-standalone:
247+
needs: [setup, build-unity-installer]
248+
uses: ./.github/workflows/test_unity_plugin.yml
249+
with:
250+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
251+
unityVersion: '2022.3.62f1'
252+
testMode: 'standalone'
253+
secrets: inherit
254+
255+
test-unity-6000-0-58f1-standalone:
256+
needs: [setup, build-unity-installer]
257+
uses: ./.github/workflows/test_unity_plugin.yml
258+
with:
259+
projectPath: ${{ needs.setup.outputs.UnityProjectPath }}
260+
unityVersion: '6000.0.58f1'
261+
testMode: 'standalone'
262+
secrets: inherit
263+
264+
# -------------------
265+
266+
release-unity-plugin:
267+
runs-on: ubuntu-latest
268+
needs: [
269+
check-version-tag,
270+
build-unity-installer,
271+
test-unity-2019-4-40f1-editmode,
272+
test-unity-2019-4-40f1-playmode,
273+
test-unity-2019-4-40f1-standalone,
274+
test-unity-2020-3-48f1-editmode,
275+
test-unity-2020-3-48f1-playmode,
276+
test-unity-2020-3-48f1-standalone,
277+
test-unity-2021-3-45f1-editmode,
278+
test-unity-2021-3-45f1-playmode,
279+
test-unity-2021-3-45f1-standalone,
280+
test-unity-2022-3-62f1-editmode,
281+
test-unity-2022-3-62f1-playmode,
282+
test-unity-2022-3-62f1-standalone,
283+
test-unity-6000-0-58f1-editmode,
284+
test-unity-6000-0-58f1-playmode,
285+
test-unity-6000-0-58f1-standalone
286+
]
287+
if: needs.check-version-tag.outputs.tag_exists == 'false'
288+
outputs:
289+
version: ${{ needs.check-version-tag.outputs.version }}
290+
success: ${{ steps.rel_desc.outputs.success }}
291+
steps:
292+
- name: Checkout repository
293+
uses: actions/checkout@v4
294+
with:
295+
fetch-depth: 0
296+
fetch-tags: true
297+
298+
- name: Generate release description
299+
id: rel_desc
300+
env:
301+
GH_TOKEN: ${{ github.token }}
302+
run: |
303+
set -e
304+
version=${{ needs.check-version-tag.outputs.version }}
305+
prev_tag=${{ needs.check-version-tag.outputs.prev_tag }}
306+
repo_url="https://github.com/${GITHUB_REPOSITORY}"
307+
today=$(date +'%B %e, %Y')
308+
309+
echo "repo_url: $repo_url"
310+
echo "today: $today"
311+
312+
echo "# Unity Gyroscope Parallax $version" > release.md
313+
echo "**Released:** *$today*" >> release.md
314+
315+
echo "" >> release.md
316+
echo "---" >> release.md
317+
echo "" >> release.md
318+
319+
if [ -n "$prev_tag" ]; then
320+
echo "## Comparison" >> release.md
321+
echo "See every change: [Compare $prev_tag...$version]($repo_url/compare/$prev_tag...$version)" >> release.md
322+
323+
echo "" >> release.md
324+
echo "---" >> release.md
325+
echo "" >> release.md
326+
327+
echo "## Commit Summary (Newest → Oldest)" >> release.md
328+
for sha in $(git log --pretty=format:'%H' $prev_tag..HEAD); do
329+
username=$(gh api repos/${GITHUB_REPOSITORY}/commits/$sha --jq '.author.login // .commit.author.name')
330+
message=$(git log -1 --pretty=format:'%s' $sha)
331+
short_sha=$(git log -1 --pretty=format:'%h' $sha)
332+
echo "- [\`$short_sha\`]($repo_url/commit/$sha) — $message by @$username" >> release.md
333+
done
334+
fi
335+
336+
printf "release_body<<ENDOFRELEASEBODY\n%s\nENDOFRELEASEBODY\n" "$(cat release.md)" >> $GITHUB_OUTPUT
337+
echo "success=true" >> $GITHUB_OUTPUT
338+
339+
- name: Create Tag and Release
340+
uses: softprops/action-gh-release@v2
341+
with:
342+
tag_name: ${{ needs.check-version-tag.outputs.version }}
343+
name: ${{ needs.check-version-tag.outputs.version }}
344+
body: ${{ steps.rel_desc.outputs.release_body }}
345+
draft: false
346+
prerelease: false
347+
env:
348+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
349+
350+
publish-unity-installer:
351+
runs-on: ubuntu-latest
352+
needs: [setup, release-unity-plugin]
353+
steps:
354+
- name: Download Unity Package artifact
355+
uses: actions/download-artifact@v4
356+
with:
357+
name: unity-installer-package
358+
path: ./
359+
360+
- name: Upload Unity Package to Release
361+
uses: softprops/action-gh-release@v2
362+
with:
363+
files: ./${{ needs.setup.outputs.InstallerFileName }}.unitypackage
364+
tag_name: ${{ needs.release-unity-plugin.outputs.version }}
365+
env:
366+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
367+
368+
# Cleanup job to remove build artifacts after publishing
369+
cleanup-artifacts:
370+
runs-on: ubuntu-latest
371+
needs: [publish-unity-installer]
372+
if: always()
373+
steps:
374+
- name: Delete Unity Package artifacts
375+
uses: geekyeggo/delete-artifact@v5
376+
with:
377+
name: unity-installer-package
378+
failOnError: false
379+
continue-on-error: true

0 commit comments

Comments
 (0)