From da3d1161d83981b1d9e681d2f7887b0d0c322edf Mon Sep 17 00:00:00 2001 From: Camille Galladjov Date: Mon, 1 Mar 2021 01:06:49 +0300 Subject: [PATCH] #62 packing nuget for both Debug and Release configurations --- .github/workflows/nuget-release.yml | 50 ++++++++++++++++++----------- Makefile | 24 ++++++++++++++ Svelto.ECS/Svelto.ECS.csproj | 11 +++++-- Svelto.ECS/Svelto.ECS.nuspec | 20 ++++++++++++ Svelto.ECS/Svelto.ECS.targets | 9 ++++++ 5 files changed, 94 insertions(+), 20 deletions(-) create mode 100644 Makefile create mode 100644 Svelto.ECS/Svelto.ECS.nuspec create mode 100644 Svelto.ECS/Svelto.ECS.targets diff --git a/.github/workflows/nuget-release.yml b/.github/workflows/nuget-release.yml index 2387f7e..f678de3 100644 --- a/.github/workflows/nuget-release.yml +++ b/.github/workflows/nuget-release.yml @@ -30,36 +30,50 @@ jobs: run: git clone https://github.com/Ujinjinjin/upm-preparator.git --branch v1.0.12 --single-branch - name: create temp directory - run: mkdir temp + run: mkdir temp temp/com.sebaslab.svelto.common temp/com.sebaslab.svelto.ecs temp/bin temp/bin/debug temp/bin/release - name: create solution file run: dotnet new sln -n "${PKG_NAME}" -o temp/ - # Svelto.Common - - name: create temp Svelto.Common directory - run: mkdir "temp/com.sebaslab.svelto.common" - + # Prepare solution - name: copy Svelto.Common files to temp directory run: cp -r Svelto.Common/* "temp/com.sebaslab.svelto.common" - - name: add Svelto.Common to solution - run: dotnet sln "temp/${PKG_NAME}.sln" add "temp/com.sebaslab.svelto.common/Svelto.Common.csproj" - - # Svelto.ECS - - name: get Svelto.ECS version - run: python3 upm-preparator/version.py --version-file "${ECS_VERSION_JSON}" --env-file "${GITHUB_ENV}" - - - name: create temp Svelto.ECS directory - run: mkdir "temp/com.sebaslab.svelto.ecs" - - name: copy Svelto.ECS files to temp directory run: cp -r Svelto.ECS/* "temp/com.sebaslab.svelto.ecs" + - name: add Svelto.Common to solution + run: dotnet sln "temp/${PKG_NAME}.sln" add "temp/com.sebaslab.svelto.common/Svelto.Common.csproj" + - name: add Svelto.ECS to solution run: dotnet sln "temp/${PKG_NAME}.sln" add "temp/com.sebaslab.svelto.ecs/Svelto.ECS.csproj" + + # Build for Debug + - name: create package for Debug configuration + run: dotnet pack /p:Version=1.0.0 -o temp/bin/debug temp/com.sebaslab.svelto.ecs/Svelto.ECS.csproj -c Debug + + - name: unzip debug nuget package + run: unzip temp/bin/debug/Svelto.ECS.1.0.0.nupkg -d temp/bin/debug + + - name: copy debug DLL to temp folder + run: sudo cp temp/bin/debug/lib/netstandard2.0/Svelto.ECS.dll temp/bin/debug + + # Build for Release + - name: create package for Release configuration + run: dotnet pack /p:Version=1.0.0 -o temp/bin/release temp/com.sebaslab.svelto.ecs/Svelto.ECS.csproj -c Release + + - name: unzip release nuget package + run: unzip temp/bin/release/Svelto.ECS.1.0.0.nupkg -d temp/bin/release + + - name: copy release DLL to temp folder + run: sudo cp temp/bin/release/lib/netstandard2.0/Svelto.ECS.dll temp/bin/release + + # Compile into nuget package + - name: get Svelto.ECS version + run: python3 upm-preparator/version.py --version-file "${ECS_VERSION_JSON}" --env-file "${GITHUB_ENV}" - name: build nuget package - run: dotnet pack /p:Version=${PKG_VERSION} -o . "temp/com.sebaslab.svelto.ecs/Svelto.ECS.csproj" + run: sudo dotnet pack /p:PackageVersion=${PKG_VERSION} -o . temp/com.sebaslab.svelto.ecs/Svelto.ECS.csproj -c Custom - - name: publish nuget package - run: dotnet nuget push ${{ env.PKG_NAME }}.${{ env.PKG_VERSION }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json + # - name: publish nuget package + # run: dotnet nuget push ${{ env.PKG_NAME }}.${{ env.PKG_VERSION }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dcb0047 --- /dev/null +++ b/Makefile @@ -0,0 +1,24 @@ +pkg_name := "Svelto.ECS" + +nuget_pack: + make nuget_clean + mkdir temp temp/com.sebaslab.svelto.common temp/com.sebaslab.svelto.ecs temp/bin temp/bin/debug temp/bin/release + dotnet new sln -n ${pkg_name} -o temp/ + cp -r Svelto.Common/* temp/com.sebaslab.svelto.common + cp -r Svelto.ECS/* temp/com.sebaslab.svelto.ecs + dotnet sln temp/${pkg_name}.sln add temp/com.sebaslab.svelto.common/Svelto.Common.csproj + dotnet sln temp/${pkg_name}.sln add temp/com.sebaslab.svelto.ecs/Svelto.ECS.csproj + # Build for Debug + dotnet pack /p:Version=1.0.0 -o temp/bin/debug temp/com.sebaslab.svelto.ecs/Svelto.ECS.csproj -c Debug + unzip temp/bin/debug/Svelto.ECS.1.0.0.nupkg -d temp/bin/debug + cp temp/bin/debug/lib/netstandard2.0/Svelto.ECS.dll temp/bin/debug + # Build for Release + dotnet pack /p:Version=1.0.0 -o temp/bin/release temp/com.sebaslab.svelto.ecs/Svelto.ECS.csproj -c Release + unzip temp/bin/release/Svelto.ECS.1.0.0.nupkg -d temp/bin/release + cp temp/bin/release/lib/netstandard2.0/Svelto.ECS.dll temp/bin/release + # Compile into nuget + dotnet pack /p:PackageVersion=2.0.0 -o . temp/com.sebaslab.svelto.ecs/Svelto.ECS.csproj -c Custom + make nuget_clean + +nuget_clean: + rm -rf upm-preparator temp \ No newline at end of file diff --git a/Svelto.ECS/Svelto.ECS.csproj b/Svelto.ECS/Svelto.ECS.csproj index 69bc333..8435a68 100644 --- a/Svelto.ECS/Svelto.ECS.csproj +++ b/Svelto.ECS/Svelto.ECS.csproj @@ -1,4 +1,4 @@ - + Svelto.ECS 7.3 @@ -7,7 +7,9 @@ Svelto.ECS sebas77 - https://github.com/sebas77/Svelto.ECS + https://github.com/sebas77/Svelto.ECS + Svelto.ECS.nuspec + version=$(PackageVersion) AnyCPU @@ -19,6 +21,11 @@ false true + + AnyCPU + false + true + diff --git a/Svelto.ECS/Svelto.ECS.nuspec b/Svelto.ECS/Svelto.ECS.nuspec new file mode 100644 index 0000000..86b5ed7 --- /dev/null +++ b/Svelto.ECS/Svelto.ECS.nuspec @@ -0,0 +1,20 @@ + + + + Svelto.ECS + sebas77 + $version$ + C# Lightweight Data Oriented Entity Component System Framework + https://github.com/sebas77/Svelto.ECS + https://raw.githubusercontent.com/sebas77/Svelto.ECS/master/LICENSE + + + + + + + + + + + diff --git a/Svelto.ECS/Svelto.ECS.targets b/Svelto.ECS/Svelto.ECS.targets new file mode 100644 index 0000000..ac85f65 --- /dev/null +++ b/Svelto.ECS/Svelto.ECS.targets @@ -0,0 +1,9 @@ + + + + + $(MSBuildThisFileDirectory)../lib/Release/netstandard2.0/Svelto.ECS.dll + $(MSBuildThisFileDirectory)../lib/Debug/netstandard2.0/Svelto.ECS.dll + + + \ No newline at end of file