Skip to content

Commit 9d3c8e1

Browse files
feat: Add restore step (MAPCO-9046) (#32)
* add Assets/Packages to git ignore * add nuget manager * add meta file * add nugetforunity-restore and modify build code * change workflow to action * change path * delete file * revert packages changes * add nuget * add packages file
1 parent 1a5ec5d commit 9d3c8e1

File tree

10 files changed

+121
-0
lines changed

10 files changed

+121
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: NuGetForUnity Restore
2+
description: Install NuGetForUnity.Cli and restore NuGet packages for Unity
3+
4+
inputs:
5+
working-directory:
6+
description: Path to the Unity project root
7+
required: false
8+
default: .
9+
10+
runs:
11+
using: composite
12+
steps:
13+
- uses: actions/setup-dotnet@v4
14+
with:
15+
dotnet-version: 8.0.x
16+
17+
- run: dotnet tool install --global NuGetForUnity.Cli
18+
shell: bash
19+
20+
- run: nugetforunity restore
21+
working-directory: ${{ inputs.working-directory }}
22+
shell: bash

.github/workflows/release-upload.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ jobs:
4949
key: Library-${{ matrix.targetPlatform }}
5050
restore-keys: Library-
5151

52+
- uses: ./.github/actions/nugetforunity-restore
53+
with:
54+
working-directory: .
55+
5256
# Build the Unity project.
5357
- uses: game-ci/unity-builder@v4
5458
env:

.github/workflows/test-and-build.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ jobs:
3737
- name: Checkout project
3838
uses: actions/checkout@v5
3939

40+
- uses: ./.github/actions/nugetforunity-restore
41+
with:
42+
working-directory: .
43+
4044
- name: Run Unity Tests
4145
uses: game-ci/unity-test-runner@v4
4246
env:
@@ -73,6 +77,10 @@ jobs:
7377
key: Library-${{ matrix.targetPlatform }}
7478
restore-keys: Library-
7579

80+
- uses: ./.github/actions/nugetforunity-restore
81+
with:
82+
working-directory: .
83+
7684
# Build project.
7785
- uses: game-ci/unity-builder@v4
7886
env:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,6 @@ InitTestScene*.unity*
105105

106106
# Auto-generated scenes by play mode tests
107107
/[Aa]ssets/[Ii]nit[Tt]est[Ss]cene*.unity*
108+
109+
/[Aa]ssets/Packages
110+
/[Aa]ssets/Packages.meta

Assets/NuGet.config

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" enableCredentialProvider="false" />
6+
</packageSources>
7+
<disabledPackageSources />
8+
<activePackageSource>
9+
<add key="All" value="(Aggregate source)" />
10+
</activePackageSource>
11+
<config>
12+
<add key="packageInstallLocation" value="CustomWithinAssets" />
13+
<add key="repositoryPath" value="./Packages" />
14+
<add key="PackagesConfigDirectoryPath" value="." />
15+
<add key="slimRestore" value="true" />
16+
<add key="PreferNetStandardOverNetFramework" value="true" />
17+
</config>
18+
</configuration>

Assets/NuGet.config.meta

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/packages.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages />

Assets/packages.config.meta

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/manifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"dependencies": {
33
"com.cesium.unity": "1.17.0",
44
"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask",
5+
"com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity",
56
"com.mapcolonies.yahalom-ui": "https://github.com/MapColonies/yahalom-ui-components.git?path=/Assets/YahalomUIPackage",
67
"com.unity.ide.rider": "3.0.36",
78
"com.unity.localization": "1.5.8",

Packages/packages-lock.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
"dependencies": {},
2020
"hash": "64285ae060c9fe2aeb2a73b076b160939ce3be1a"
2121
},
22+
"com.github-glitchenzo.nugetforunity": {
23+
"version": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity",
24+
"depth": 0,
25+
"source": "git",
26+
"dependencies": {},
27+
"hash": "34432703a177c97631a4eb1d908f086037c67969"
28+
},
2229
"com.mapcolonies.yahalom-ui": {
2330
"version": "https://github.com/MapColonies/yahalom-ui-components.git?path=/Assets/YahalomUIPackage",
2431
"depth": 0,

0 commit comments

Comments
 (0)