Browse Source

Merge pull request #70 from Ujinjinjin/nuget-pipeline-fix

fixed nuget publishing pipeline
pull/72/head
Sebastiano Mandalà GitHub 2 years ago
parent
commit
965eab963e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 37 deletions
  1. +6
    -22
      .github/workflows/nuget-release.yml
  2. +8
    -10
      Makefile
  3. +12
    -3
      Svelto.ECS/Svelto.ECS.csproj
  4. +2
    -2
      Svelto.ECS/Svelto.ECS.nuspec

+ 6
- 22
.github/workflows/nuget-release.yml View File

@@ -30,27 +30,11 @@ jobs:
run: git clone https://github.com/Ujinjinjin/upm-preparator.git --branch v1.0.12 --single-branch

- name: create temp directory
run: mkdir temp temp/com.sebaslab.svelto.common temp/com.sebaslab.svelto.ecs temp/bin temp/bin/debug temp/bin/release
- name: copy solution file
run: cp Svelto.ECS.sln "temp/Svelto.ECS.sln"
# Prepare solution
- name: copy Svelto.Common files to temp directory
run: cp -r Svelto.Common/* "temp/com.sebaslab.svelto.common"
- 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"
run: mkdir temp temp/bin temp/bin/debug temp/bin/release
# 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
run: dotnet pack /p:PackageVersion=1.0.0 -o temp/bin/debug 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
@@ -60,7 +44,7 @@ jobs:

# 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
run: dotnet pack /p:PackageVersion=1.0.0 -o temp/bin/release 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
@@ -73,7 +57,7 @@ jobs:
run: python3 upm-preparator/version.py --version-file "${ECS_VERSION_JSON}" --env-file "${GITHUB_ENV}"

- name: build nuget package
run: sudo dotnet pack /p:PackageVersion=${PKG_VERSION} -o . temp/com.sebaslab.svelto.ecs/Svelto.ECS.csproj -c Custom
run: sudo dotnet pack /p:PackageVersion=${PKG_VERSION} -o . Svelto.ECS/Svelto.ECS.csproj -c NugetPack

# - 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

+ 8
- 10
Makefile View File

@@ -2,23 +2,21 @@ 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
mkdir temp temp/bin temp/bin/debug temp/bin/release

# Build for Debug
dotnet pack /p:Version=1.0.0 -o temp/bin/debug temp/com.sebaslab.svelto.ecs/Svelto.ECS.csproj -c Debug
dotnet pack /p:PackageVersion=1.0.0 -o temp/bin/debug 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
dotnet pack /p:PackageVersion=1.0.0 -o temp/bin/release 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
dotnet pack /p:PackageVersion=2.0.0 -o . Svelto.ECS/Svelto.ECS.csproj -c NugetPack
make nuget_clean

nuget_clean:
rm -rf upm-preparator temp
rm -rf temp

+ 12
- 3
Svelto.ECS/Svelto.ECS.csproj View File

@@ -1,14 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Svelto.ECS</AssemblyName>
<LangVersion>8</LangVersion>
<TargetFramework>netstandard2.0</TargetFramework>
<Company>Svelto</Company>
<AssemblyVersion>3.2.1</AssemblyVersion>
<PackageVersion>3.2.1</PackageVersion>
</PropertyGroup>
<PropertyGroup>
<PackageId>Svelto.ECS</PackageId>
<Authors>sebas77</Authors>
<Authors>Sebastiano Mandala</Authors>
<RepositoryUrl>https://github.com/sebas77/Svelto.ECS</RepositoryUrl>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
@@ -21,10 +22,18 @@
<UseSharedCompilation>false</UseSharedCompilation>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'NugetPack' "> <!-- Do not delete. Used for nuget packing -->
<NuspecFile>Svelto.ECS.nuspec</NuspecFile>
<NuspecProperties>version=$(PackageVersion)</NuspecProperties>
<PlatformTarget>AnyCPU</PlatformTarget>
<UseSharedCompilation>false</UseSharedCompilation>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.2" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.6.0-preview8.19405.3" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.6.0" />
<None Remove="**\*.meta" />
<ProjectReference Include="..\com.sebaslab.svelto.common\Svelto.Common.csproj" />
<ProjectReference Include="..\Svelto.Common\Svelto.Common.csproj" /> <!-- Do not delete. Used for nuget packing -->
</ItemGroup>
</Project>

+ 2
- 2
Svelto.ECS/Svelto.ECS.nuspec View File

@@ -14,7 +14,7 @@
</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/" />
<file src="../temp/bin/debug/Svelto.ECS.dll" target="lib/Debug/netstandard2.0/" />
<file src="../temp/bin/release/Svelto.ECS.dll" target="lib/Release/netstandard2.0/" />
</files>
</package>

Loading…
Cancel
Save