Skip to content

Add the NuGet badge (#4) #17

Add the NuGet badge (#4)

Add the NuGet badge (#4) #17

Workflow file for this run

name: CI
on:
push:
branches: [ 'main' ]
pull_request:
branches: [ '*' ]
release:
types: [ 'released' ]
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NOLOGO: true
DOTNET_VERSION: 7.x
DOTNET_QUALITY: ga
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
dotnet-quality: ${{ env.DOTNET_QUALITY }}
- name: Restore dependencies
run: dotnet restore *.sln
- name: Build project
run: dotnet build *.sln --no-restore -c Release
- name: Publish build artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: ${{ github.workspace }}
if-no-files-found: error
test:
name: Test
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build
path: ${{ github.workspace }}
- name: Run tests
run: dotnet test *.sln --no-build -c Release
publish:
name: Publish
if: github.event_name == 'release'
needs: [ test ]
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build
path: ${{ github.workspace }}
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
dotnet-quality: ${{ env.DOTNET_QUALITY }}
- name: Pack
run: dotnet pack *.sln --no-build -c Release
- name: Publish to NuGet.org
run: dotnet nuget push **/*.nupkg -k $NUGET_API_KEY -s https://api.nuget.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}