Skip to content

Commit 17842f1

Browse files
authored
Fixes (#34)
- Fix readme - Fix deploy ps1
2 parents e4fdd14 + c497d8b commit 17842f1

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ It includes abstractions and default implementations to facilitate easy integrat
1515
* [Service Registration](#service-registration)
1616
* [Configure Cache](#configure-cache)
1717
* [Consumption](#consumption)
18-
* [ASP.NET Core Integration](#asp.net-core-integration)
18+
* [ASP.NET Core Integration](#aspnet-core-integration)
1919
* [Built-in Database Providers](#built-in-database-providers)
2020
* [Entity Framework Core](#entity-framework-core)
2121
* [Dapper](#dapper)

build/Versioning.props

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,11 @@
3232
<Version>$(MajorVersion).$(MinorVersion).$(PatchVersion)$(VersionSuffix)</Version>
3333
</PropertyGroup>
3434

35+
<Target Name="GetVersion">
36+
<Message Importance="High" Text="$(Version)" />
37+
<PropertyGroup>
38+
<VersionOutput>$(Version)</VersionOutput>
39+
</PropertyGroup>
40+
</Target>
41+
3542
</Project>

deploy.ps1

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pack&push.ps1
1+
# deploy.ps1
22
param (
33
[string]$Configuration = "Release",
44
[string]$PackageOutput = "$(pwd)/artifacts",
@@ -11,33 +11,34 @@ if (-not (Test-Path -Path $PackageOutput)) {
1111
New-Item -ItemType Directory -Path $PackageOutput | Out-Null
1212
}
1313

14-
# Iterate over each project in the src directory
15-
Get-ChildItem -Path src -Filter FeatureManagement.* -Directory | ForEach-Object {
14+
# Iterate over each project to pack
15+
Get-ChildItem -Path src -Filter FeatureManagement.Database* -Directory | ForEach-Object {
1616
$projectPath = $_.FullName
1717
$projectName = $_.Name
18-
$csprojPath = Join-Path -Path $projectPath -ChildPath "$projectName.csproj"
18+
$csprojPath = Join-Path -Path $projectPath -ChildPath "${projectName}.csproj"
1919

2020
try {
21-
$version = dotnet msbuild $csprojPath -nologo -t:GetVersion -v:q -p:OutputProperty=Version
21+
$version = dotnet msbuild $csprojPath -nologo -t:GetVersion -p:Configuration=$configuration | ForEach-Object { $_.Trim() }
2222

2323
if (-not $version) {
24-
throw "Failed to retrieve version for project $projectName"
24+
throw "Failed to retrieve version for project ${projectName}"
2525
}
2626

27-
$packageName = "$projectName.$version.nupkg"
27+
Write-Host "> Packing ${projectName} version: ${version}" -ForegroundColor "Cyan"
2828

2929
dotnet pack $projectPath --configuration $Configuration --output $PackageOutput
3030

31-
$packageExists = dotnet nuget search $projectName --version $version --source $NuGetSourceUrl | Select-String -Pattern $version
31+
$packageName = "${projectName}.${version}.nupkg"
32+
$packagePath = Join-Path -Path $PackageOutput -ChildPath $packageName
3233

33-
if (-not $packageExists) {
34-
dotnet nuget push "$PackageOutput/$packageName" -k $NuGetApiKey -s $NuGetSourceUrl
35-
Write-Host "Package $packageName version $version pushed." -ForegroundColor "Green"
34+
if (Test-Path -Path $packagePath) {
35+
dotnet nuget push $packagePath -k $NuGetApiKey -s $NuGetSourceUrl --skip-duplicate
36+
Write-Host "Package ${packageName} pushed." -ForegroundColor "Green"
3637
} else {
37-
Write-Host "Package $packageName version $version already exists on NuGet. Skipping push." -ForegroundColor "Yellow"
38+
Write-Host "Package ${packageName} already exists on NuGet. Skipping push." -ForegroundColor "Yellow"
3839
}
3940
} catch {
40-
Write-Error "Error processing project $projectName: $_"
41+
Write-Error "Error processing project ${projectName}: $_"
4142
}
4243
}
4344

0 commit comments

Comments
 (0)