Skip to content

Create workflow

Create workflow #1

Workflow file for this run

name: Build And Create Nuget Package
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [created]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'ubuntu-24.04', 'windows-latest' ]
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore src/**/*.csproj
- name: Build
run: dotnet build --no-restore -c Release src/**/*.csproj
publish:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore src/**/*.csproj
- name: Build
run: dotnet build --no-restore -c Release src/**/*.csproj
- name: Generate packages
run: dotnet pack --no-build --configuration Release src/**/*.csproj --output ./artifacts
- name: Publish to NuGet
run: dotnet nuget push artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate