Skip to content

Commit

Permalink
Add publishing script and update project metadata
Browse files Browse the repository at this point in the history
A PowerShell script called publish.ps1 has been added to automate the building, packaging, and publishing process for the project. Project metadata in Frank.PulseFlow.csproj and Directory.Build.props have also been updated to better describe the project and its properties. These changes streamline the production process and improve project documentation.
  • Loading branch information
frankhaugen committed Dec 11, 2023
1 parent 27e3695 commit cbf9857
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 3 deletions.
16 changes: 16 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,21 @@

<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>

<Authors>Frank R. Haugen</Authors>
<PublisherName>Frank R. Haugen</PublisherName>
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>Frank.PulseFlow</PackageId>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>www.github.com/frankhaugen/Frank.PulseFlow</PackageProjectUrl>
<PackageTags>Frank.PulseFlow</PackageTags>
<RepositoryUrl>www.github.com/frankhaugen/Frank.PulseFlow</RepositoryUrl>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
</ItemGroup>
</Project>
6 changes: 3 additions & 3 deletions Frank.PulseFlow/Frank.PulseFlow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<PropertyGroup>
<IsPackable>true</IsPackable>
<Description>My awesome library</Description>
<PackageTags>my,awesome,library</PackageTags>
<OutputType>Library</OutputType>
<Description>PulseFlow uses Channel -mechanism for internal messaging</Description>
<PackageTags>Pulse,Flow,PulseFlow</PackageTags>
<PackageReleaseNotes>Initial release</PackageReleaseNotes>
<PackageProjectUrl></PackageProjectUrl>
</PropertyGroup>

<ItemGroup>
Expand Down
39 changes: 39 additions & 0 deletions publish.ps1
Original file line number Diff line number Diff line change
@@ -1 +1,40 @@
param (
[Parameter(Mandatory=$false)]
[string]$version = (Get-Date -Format 'yyyy.MM.dd')
)

# Get directory of the script
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Definition

# Get path to the output directory
$outputDirectory = "$scriptDirectory/.artifacts"

# Get path to the publish directory
$publishDirectory = "$outputDirectory/publish"

# Get path to the package directory
$packageDirectory = "$outputDirectory/packages"

# Get path to the project file
$projectFile = "$scriptDirectory/Frank.PulseFlow/Frank.PulseFlow.csproj"

# Restore NuGet packages
Write-Host "Restoring NuGet packages..." -ForegroundColor DarkCyan
dotnet restore $projectFile | Out-Null

# Clean output directories
if (Test-Path $publishDirectory) { Remove-Item "$publishDirectory/*" -Recurse }
if (Test-Path $packageDirectory) { Remove-Item "$packageDirectory/*" -Recurse }

# Build the solution in the specified mode
Write-Host "Building solution in Release mode..." -ForegroundColor DarkCyan
dotnet build $projectFile --configuration Release --no-restore /p:Version=$version | Out-Null

# Pack NuGet packages
Write-Host "Packing NuGet packages..." -ForegroundColor DarkCyan
dotnet pack $projectFile --configuration Release --output $packageDirectory --no-build /p:Version=$version /p:PackageVersion=$version | Out-Null

# Publish the solution and pack NuGet packages
Write-Host "Publishing the project..." -ForegroundColor DarkCyan
dotnet publish $projectFile --configuration Release --output $publishDirectory --no-build /p:Version=$version /p:PackageVersion=$version | Out-Null
Write-Host "Project has been published." -ForegroundColor Green

0 comments on commit cbf9857

Please sign in to comment.