Skip to content

Commit

Permalink
build: 💚 some change for generate version in the build
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdihadeli committed Aug 21, 2024
1 parent e8aab56 commit ba00a1a
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 47 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ jobs:
run: dotnet restore Vertical.Slice.Template.sln

- name: Build Version ${{ steps.nbgv.outputs.nugetpackageversion }}
run: dotnet build Vertical.Slice.Template.sln -c Release --no-restore /p:Version=${{ steps.nbgv.outputs.AssemblyVersion }}
run: dotnet build Vertical.Slice.Template.sln -c Release --no-restore /p:Version=${{ steps.nbgv.outputs.SemVer2 }}

# https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-pack
- name: Pack NuGet Package Version ${{ steps.nbgv.outputs.nugetpackageversion }}
run: dotnet pack Vertical.Slice.Template.sln --no-build --no-restore -c Release --output ${{ env.NuGetDirectory }}
run: dotnet pack vertical-slice-template.csproj -c Release -o ${{ env.NuGetDirectory }}

# Publish the NuGet package as an artifact, so they can be used in the following jobs
- uses: actions/upload-artifact@v3
Expand Down
7 changes: 2 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Condition="!Exists('packages.config')">
<PrivateAssets>all</PrivateAssets>
<Version>1.2.0</Version>
</PackageReference>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.133" PrivateAssets="all" Condition="!Exists('packages.config')" />
</ItemGroup>
</Project>
</Project>
2 changes: 2 additions & 0 deletions Vertical.Slice.Template.sln
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution-items", "solution-
package.json = package.json
readme.md = readme.md
version.json = version.json
vertical-slice-template.csproj = vertical-slice-template.csproj
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{154A55C1-CE45-463D-B411-816C702D6A25}"
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,4 @@
<ItemGroup>
<PackageVersion Include="NSubstitute" Version="5.1.0" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>

<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AssemblyName>Vertical.Slice.Template.Shared</AssemblyName>
<RootNamespace>Vertical.Slice.Template.Shared</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Ardalis.Specification.EntityFrameworkCore" />
<PackageReference Include="Asp.Versioning.Http" />
Expand Down
18 changes: 9 additions & 9 deletions tests/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<!-- https://docs.microsoft.com/en-us/visualstudio/msbuild/customize-your-build -->
<Project>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<NoWarn>CS1587,CS1591,CS1998,NU5105</NoWarn>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<NoWarn>CS1587,CS1591,CS1998,NU5105</NoWarn>
</PropertyGroup>

<!-- https://codyanhorn.tech/blog/excluding-your-net-test-project-from-code-coverage -->
<ItemGroup>
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" />
</ItemGroup>
<!-- https://codyanhorn.tech/blog/excluding-your-net-test-project-from-code-coverage -->
<ItemGroup>
<AssemblyAttribute Include="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Vertical.Slice.Template.TestsShared</AssemblyName>
<RootNamespace>Vertical.Slice.Template.TestsShared</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Meziantou.Extensions.Logging.InMemory" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
Expand Down Expand Up @@ -45,11 +40,4 @@
<ProjectReference Include="..\..\src\Vertical.Slice.Template.Shared\Vertical.Slice.Template.Shared.csproj" />
</ItemGroup>

<ItemGroup>
<PackageVersion Update="Nerdbank.GitVersioning" Version="3.6.133">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.2.0",
"version": "1.2.1",
"publicReleaseRefSpec": ["^refs/heads/release/v\\d+(?:\\.\\d+)?$"],
"release": {
"branchName": "release/v{version}",
Expand Down
22 changes: 12 additions & 10 deletions Template.csproj → vertical-slice-template.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<Authors>Mehdi Hadeli</Authors>
<Description>An asp.net core template based on Vertical Slice Architecture, CQRS, Minimal APIs, API Versioning and Swagger.</Description>
<PackageTags>dotnet;dotnet-core;templates;csharp;vertical-slices;vertical-slices-architecture;clean-architecture;cqrs;minimal-api</PackageTags>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeContentInPack>true</IncludeContentInPack>
<IncludeBuildOutput>false</IncludeBuildOutput>
<ContentTargetFolders>content</ContentTargetFolders>
Expand All @@ -28,19 +27,22 @@
<RepositoryBranch>main</RepositoryBranch>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<PackageIcon>icon.png</PackageIcon>
<EnablePackageValidation>true</EnablePackageValidation>
<EnablePackageValidation>true</EnablePackageValidation>
</PropertyGroup>

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>


<ItemGroup>
<Content Include="**\*" Exclude="**\bin\**\*;**\obj\**\*;**\.template.config\**\*;Template.csproj;Template.nuspec;icon.png;**\*.user;**\*.lock.json;**\node_modules\**\*;**\.idea\**\*;**\.DS_Store;**\.git\**\*;**\.github\**\*;**\.vs\**\*;**\*LICENSE;**\*nupkg;**\*.gitattributes;**\*.gitignore;**\*nuget.config;" />
<Compile Remove="**\*" />
<Content Include="**\*" Exclude="**\bin\**\*;**\obj\**\*;**\.template.config\**\*;vertical-slice-template.csproj.csproj;vertical-slice-template.csproj.nuspec;icon.png;**\*.user;**\*.lock.json;**\node_modules\**\*;**\.idea\**\*;**\.DS_Store;**\.git\**\*;**\.github\**\*;**\.vs\**\*;**\*LICENSE;**\*nupkg;**\*.gitattributes;**\*.gitignore;**\*nuget.config;"/>
<Compile Remove="**\*"/>
</ItemGroup>

<ItemGroup>
<None Include="icon.png" Pack="true" PackagePath="\"/>
<None Include="readme.md" Pack="true" PackagePath="\"/>
<None Include="readme-nuget.md" Pack="true" PackagePath="\"/>
<None Include="icon.png" Pack="true" PackagePath="\"/>
<None Include="readme.md" Pack="true" PackagePath="\"/>
<None Include="readme-nuget.md" Pack="true" PackagePath="\"/>
</ItemGroup>
</Project>

</Project>

0 comments on commit ba00a1a

Please sign in to comment.