Create project files

This commit is contained in:
Dmitri Shimanski
2025-03-29 02:34:08 +03:00
commit abab2be4f4
32 changed files with 1057 additions and 0 deletions

23
.github/workflows/dotnet.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: .NET Tests
on:
push:
branches: [ "*" ]
pull_request:
branches: [ "*" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: [6.0.x, 7.0.x, 8.0.x, 9.0.x]
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore /p:TreatWarningsAsErrors=false
- name: Test
run: dotnet test --no-build --verbosity normal

48
.github/workflows/nuget.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: CI/CD NuGet Package
on:
release:
types: [created]
env:
NUGET_SOURCE: https://api.nuget.org/v3/index.json
GITHUB_SOURCE: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Extract Package Version
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_ENV
echo "Using version: $VERSION"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --verbosity normal --configuration Release
- name: Pack
run: dotnet pack --no-build --configuration Release -p:PackageVersion=${{ env.PACKAGE_VERSION }}
- name: Add GitHub source
run: dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.GHCR_TOKEN }} --store-password-in-clear-text --name github ${{ env.GITHUB_SOURCE }}
- name: Publish to GitHub Packages
run: dotnet nuget push "**/*.nupkg" --source "github"
- name: Publish to NuGet
run: dotnet nuget push "**/*.nupkg" --source ${{ env.NUGET_SOURCE }} --api-key ${{ secrets.NUGET_API_KEY }}