feat: Add type-safe generics and improve error handling in ResultObject #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
workflow_dispatch: # Allow running the workflow manually from the GitHub UI | |
push: | |
branches: | |
- 'main' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build solution | |
run: dotnet build -c Release --no-restore | |
- name: Run tests | |
run: dotnet test -c Release --no-build --verbosity normal | |
- name: Upload NuGet Package Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nuget-packages | |
path: src/ResultObject/bin/Release | |
validate: | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Download NuGet Package Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: nuget-packages | |
path: src/ResultObject/bin/Release | |
- name: Install Meziantou NuGet Package Validation Tool | |
run: dotnet tool install --global Meziantou.Framework.NuGetPackageValidation.Tool | |
- name: Validate NuGet Package | |
run: meziantou.validate-nuget-package src/ResultObject/bin/Release/*.nupkg | |
publish: | |
if: github.ref == 'refs/heads/main' | |
needs: validate | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Download NuGet Package Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: nuget-packages | |
path: src/ResultObject/bin/Release | |
- name: Publish to NuGet | |
run: dotnet nuget push src/ResultObject/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} |