diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..5d37c78 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml new file mode 100644 index 0000000..23a2dd3 --- /dev/null +++ b/.github/workflows/publish-nuget.yml @@ -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 ''; 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 diff --git a/src/TypedRequestContext.Propagation/TypedRequestContext.Propagation.csproj b/src/TypedRequestContext.Propagation/TypedRequestContext.Propagation.csproj index 1865fdd..8a11dbc 100644 --- a/src/TypedRequestContext.Propagation/TypedRequestContext.Propagation.csproj +++ b/src/TypedRequestContext.Propagation/TypedRequestContext.Propagation.csproj @@ -5,10 +5,19 @@ enable enable TypedRequestContext.Propagation + 1.0.0 + Otapiero Optional propagation extension for TypedRequestContext with serializer/deserializer and header provider support. + MIT + https://github.com/Zio-Net/TypedRequestContext + README.md true + + + + diff --git a/src/TypedRequestContext/TypedRequestContext.csproj b/src/TypedRequestContext/TypedRequestContext.csproj index 0a50909..0c32b1e 100644 --- a/src/TypedRequestContext/TypedRequestContext.csproj +++ b/src/TypedRequestContext/TypedRequestContext.csproj @@ -5,10 +5,19 @@ enable enable TypedRequestContext + 1.0.0 + Otapiero Typed request context middleware for ASP.NET Core with AsyncLocal accessor support. + MIT + https://github.com/Zio-Net/TypedRequestContext + README.md true + + + +