diff --git a/.github/workflows/nuget.yml b/.github/workflows/nuget.yml new file mode 100644 index 0000000..a223bad --- /dev/null +++ b/.github/workflows/nuget.yml @@ -0,0 +1,29 @@ +name: Release NuGet Package +on: + release: + types: [published] # Triggers when you create a GitHub Release +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + id-token: write # Required for OIDC + contents: read + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 10.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build -c Release -p:Version=${GITHUB_REF_NAME#v} --no-restore + - name: Run Tests + run: dotnet test -c Release --report-trx --results-directory=".artifacts/test-results" --no-build --no-restore + - name: Pack Nuget + run: dotnet pack -c Release -p:Version=${GITHUB_REF_NAME#v} -o .artifacts/packages --no-build --no-restore + - name: Authenticate with NuGet via OIDC + uses: NuGet/login@v1 + id: nuget-login + - name: Push Nuget + run: dotnet nuget push ".artifacts/packages/**/*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ steps.nuget-login.outputs.NUGET_API_KEY }} --skip-duplicate \ No newline at end of file diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7c587a6..d675593 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,36 +1,25 @@ -name: .NET - -# Trigger build and test whenever a pull request is opened or updated against target branches +name: PR Workflow on: pull_request: - branches: [ "master" ] - + branches: [ "master" ] # Triggers when you create a PR targeting a master branch jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 10.0.x - - name: Restore dependencies - run: dotnet restore - + run: dotnet restore - name: Build - run: dotnet build --no-restore - - - name: Test - run: dotnet test --report-trx --results-directory=".artifacts/test-results" || true - - - name: Test Report + run: dotnet build --no-restore + - name: Run Tests + run: dotnet test --report-trx --results-directory=".artifacts/test-results" --no-build --no-restore || true + - name: Publish Test Report uses: dorny/test-reporter@v1 - if: always() + if: always() with: name: .NET Core Tests path: ".artifacts/test-results/**/*.trx" diff --git a/Directory.Build.props b/Directory.Build.props index ed7f581..305088b 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,9 +1,5 @@ - - 0.0.1 - - true $(MSBuildThisFileDirectory).artifacts/ @@ -15,6 +11,11 @@ false + + true + true + + false true @@ -23,8 +24,9 @@ false - true - $([System.String]::Copy('$(MSBuildProjectName)').Replace('.UnitTests','')) + true + true + $([System.String]::Copy('$(MSBuildProjectName)').Replace('.UnitTests','').Replace('.IntegrationTests','').Replace('.Tests','')) @@ -32,13 +34,17 @@ MIT Igor Sinicyn CodeMe + CodeMe https://github.com/ig-sinicyn/CodeMe - https://github.com/ig-sinicyn/CodeMe.git - git + true + true + snupkg + + @@ -51,7 +57,7 @@ - + diff --git a/cicd/cicd.csproj b/cicd/cicd.csproj index 6d2708d..3cd1421 100644 --- a/cicd/cicd.csproj +++ b/cicd/cicd.csproj @@ -5,8 +5,8 @@ - - .github\%(RecursiveDir)%(Filename)%(Extension) + + .github/%(RecursiveDir)%(Filename)%(Extension) diff --git a/env/env.csproj b/env/env.csproj index 7d5c0d3..970527f 100644 --- a/env/env.csproj +++ b/env/env.csproj @@ -5,10 +5,10 @@ - + %(Filename)%(Extension) - + diff --git a/src/CodeMe.ServiceErrors.Abstractions/CodeMe.ServiceErrors.Abstractions.csproj b/src/CodeMe.ServiceErrors.Abstractions/CodeMe.ServiceErrors.Abstractions.csproj index 4b236ec..9199871 100644 --- a/src/CodeMe.ServiceErrors.Abstractions/CodeMe.ServiceErrors.Abstractions.csproj +++ b/src/CodeMe.ServiceErrors.Abstractions/CodeMe.ServiceErrors.Abstractions.csproj @@ -6,7 +6,7 @@ latest Library for typed service errors (Problem Details-alike DTOs) - errors;typed_errors + errors;typed errors diff --git a/src/CodeMe.ServiceErrors/CodeMe.ServiceErrors.csproj b/src/CodeMe.ServiceErrors/CodeMe.ServiceErrors.csproj index 10f4439..ba53439 100644 --- a/src/CodeMe.ServiceErrors/CodeMe.ServiceErrors.csproj +++ b/src/CodeMe.ServiceErrors/CodeMe.ServiceErrors.csproj @@ -4,7 +4,7 @@ net10.0 Library for typed service errors (Problem Details-alike DTOs) - errors;typed_errors + errors;typed errors README.md @@ -15,11 +15,11 @@ - + - + \ No newline at end of file