Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#62 packing nuget for both Debug and Release configurations #63

Merged
merged 1 commit into from
Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 32 additions & 18 deletions .github/workflows/nuget-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
11 changes: 9 additions & 2 deletions Svelto.ECS/Svelto.ECS.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Svelto.ECS</AssemblyName>
<LangVersion>7.3</LangVersion>
Expand All @@ -7,7 +7,9 @@
<PropertyGroup>
<PackageId>Svelto.ECS</PackageId>
<Authors>sebas77</Authors>
<RepositoryUrl>https://github.com/sebas77/Svelto.ECS</RepositoryUrl>
<RepositoryUrl>https://github.com/sebas77/Svelto.ECS</RepositoryUrl>
<NuspecFile Condition="'$(Configuration)'=='Custom'">Svelto.ECS.nuspec</NuspecFile>
<NuspecProperties Condition="'$(Configuration)'=='Custom'">version=$(PackageVersion)</NuspecProperties>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand All @@ -19,6 +21,11 @@
<UseSharedCompilation>false</UseSharedCompilation>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Custom' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<UseSharedCompilation>false</UseSharedCompilation>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\com.sebaslab.svelto.common\Svelto.Common.csproj" />
</ItemGroup>
Expand Down
20 changes: 20 additions & 0 deletions Svelto.ECS/Svelto.ECS.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>Svelto.ECS</id>
<authors>sebas77</authors>
<version>$version$</version>
<description>C# Lightweight Data Oriented Entity Component System Framework</description>
<projectUrl>https://github.com/sebas77/Svelto.ECS</projectUrl>
<licenseUrl>https://raw.githubusercontent.com/sebas77/Svelto.ECS/master/LICENSE</licenseUrl>
<repository type="git" url="https://github.com/sebas77/Svelto.ECS.git" />
<dependencies>
<group targetFramework="netstandard2.0" />
</dependencies>
</metadata>
<files>
<file src="Svelto.ECS.targets" target="build/" />
<file src="../bin/debug/Svelto.ECS.dll" target="lib/Debug/netstandard2.0/" />
<file src="../bin/release/Svelto.ECS.dll" target="lib/Release/netstandard2.0/" />
</files>
</package>
9 changes: 9 additions & 0 deletions Svelto.ECS/Svelto.ECS.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Reference Include="Svelto.ECS">
<HintPath Condition="'$(Optimize)'!='false'">$(MSBuildThisFileDirectory)../lib/Release/netstandard2.0/Svelto.ECS.dll</HintPath>
<HintPath Condition="'$(Optimize)'=='false'">$(MSBuildThisFileDirectory)../lib/Debug/netstandard2.0/Svelto.ECS.dll</HintPath>
</Reference>
</ItemGroup>
</Project>