Skip to content
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI

on:
pull_request:
branches: [main]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x

- name: Restore
run: dotnet restore

- name: Build
run: dotnet build -c Release --no-restore

- name: Test
run: dotnet test -c Release --no-build
66 changes: 66 additions & 0 deletions .github/workflows/publish-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Publish NuGet Packages

on:
push:
branches: [main]

jobs:
publish:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x

- name: Restore
run: dotnet restore

- name: Build
run: dotnet build -c Release --no-restore

- name: Test
run: dotnet test -c Release --no-build

- name: Detect version changes
id: version-check
run: |
check_version_change() {
local file="$1"
local output_name="$2"
if git diff HEAD~1 HEAD -- "$file" | grep -q '<Version>'; then
echo "${output_name}=true" >> "$GITHUB_OUTPUT"
else
echo "${output_name}=false" >> "$GITHUB_OUTPUT"
fi
}

check_version_change "src/TypedRequestContext/TypedRequestContext.csproj" "core_changed"
check_version_change "src/TypedRequestContext.Propagation/TypedRequestContext.Propagation.csproj" "propagation_changed"

- name: Pack & Push TypedRequestContext
if: steps.version-check.outputs.core_changed == 'true'
run: |
dotnet pack src/TypedRequestContext/TypedRequestContext.csproj -c Release --no-build -o ./nupkgs
dotnet nuget push ./nupkgs/TypedRequestContext.*.nupkg \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate

- name: Pack & Push TypedRequestContext.Propagation
if: steps.version-check.outputs.propagation_changed == 'true'
run: |
dotnet pack src/TypedRequestContext.Propagation/TypedRequestContext.Propagation.csproj -c Release --no-build -o ./nupkgs
dotnet nuget push ./nupkgs/TypedRequestContext.Propagation.*.nupkg \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>TypedRequestContext.Propagation</PackageId>
<Version>1.0.0</Version>
<Authors>Otapiero</Authors>
<Description>Optional propagation extension for TypedRequestContext with serializer/deserializer and header provider support.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/Zio-Net/TypedRequestContext</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\TypedRequestContext\TypedRequestContext.csproj" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
Expand Down
9 changes: 9 additions & 0 deletions src/TypedRequestContext/TypedRequestContext.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,19 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackageId>TypedRequestContext</PackageId>
<Version>1.0.0</Version>
<Authors>Otapiero</Authors>
<Description>Typed request context middleware for ASP.NET Core with AsyncLocal accessor support.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/Zio-Net/TypedRequestContext</RepositoryUrl>
<PackageReadmeFile>README.md</PackageReadmeFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
Expand Down