Skip to content

Add CI/CD workflow, README, LICENSE, and .gitignore #1

Add CI/CD workflow, README, LICENSE, and .gitignore

Add CI/CD workflow, README, LICENSE, and .gitignore #1

Workflow file for this run

name: Build & Publish
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
branches: [ main ]
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
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
- name: Pack
if: startsWith(github.ref, 'refs/tags/v')
run: |
VERSION=${GITHUB_REF#refs/tags/v}
dotnet pack --configuration Release --no-build \
-p:PackageVersion=$VERSION \
--output ./nupkgs
- name: Push to NuGet
if: startsWith(github.ref, 'refs/tags/v')
run: |
dotnet nuget push ./nupkgs/*.nupkg \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate
dotnet nuget push ./nupkgs/*.snupkg \
--api-key ${{ secrets.NUGET_API_KEY }} \
--source https://api.nuget.org/v3/index.json \
--skip-duplicate