diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f7313a0..2a667869 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,33 +101,46 @@ jobs: - name: Cleanup temporary files run: rm -rf _temp - # lint: - # name: Run Code Linting - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - - # # Download Unity editor to get the required assemblies - # - name: Request Unity activation file - # id: getManualLicenseFile - # uses: game-ci/unity-request-activation-file@v2 - - # - name: Download Unity - # uses: game-ci/unity-builder@v4 - # env: - # UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} - # UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} - # UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} - # with: - # targetPlatform: StandaloneLinux64 - - # - name: Install dotnet tools - # run: | - # dotnet new tool-manifest - # dotnet tool install JetBrains.ReSharper.GlobalTools - - # - name: Run ReSharper CLI inspection - # run: | - # jb inspectcode . --output=inspect-results.xml --severity=WARNING \ - # --include="Assets/**/*.cs" \ - # --exclude="**/Library/**/*.cs;**/Temp/**/*.cs;**/obj/**/*.cs" \ No newline at end of file + build: + name: Build Package + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + lfs: true + + # Git LFS + - name: Create LFS file list + run: git lfs ls-files -l | cut -d' ' -f1 | sort > .lfs-assets-id + + - name: Restore LFS cache + uses: actions/cache@v3 + id: lfs-cache + with: + path: .git/lfs + key: ${{ runner.os }}-lfs-${{ hashFiles('.lfs-assets-id') }} + + - name: Git LFS Pull + run: | + git lfs pull + git add . + git reset --hard + + # Unity Cache + - uses: actions/cache@v3 + with: + path: Library + key: Library-Build-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }} + restore-keys: | + Library-Build- + + # Build + - name: Build Unity Package + uses: game-ci/unity-builder@v4 + env: + UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} + UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} + UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} + with: + targetPlatform: StandaloneLinux64 + buildMethod: Editor.Builder.BuildPackage \ No newline at end of file diff --git a/Assets/Editor/Builder.cs b/Assets/Editor/Builder.cs new file mode 100644 index 00000000..c992f3f6 --- /dev/null +++ b/Assets/Editor/Builder.cs @@ -0,0 +1,25 @@ +using UnityEditor; + +namespace Editor +{ + public static class Builder + { + public static void BuildPackage() + { + // Define which assets to include in the package + string[] assets = new string[] + { + "Assets", + "Packages/manifest.json", + "Packages/packages-lock.json" + }; + + // Build the package + AssetDatabase.ExportPackage( + assets, + "Build/dojo.unitypackage", + ExportPackageOptions.Recurse | ExportPackageOptions.IncludeDependencies + ); + } + } +} \ No newline at end of file