Update build.yml #29
This file contains hidden or 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: Build C# Class Library for .NET Standard 2.x | |
| on: | |
| push: | |
| branches: | |
| # - '**' # Trigger on pushes to any branch | |
| - 'master' # Trigger on pushes to any branch | |
| # pull_request: | |
| # branches: | |
| # - '**' # Trigger on pull requests from any branch | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 #actions/checkout@v3 | |
| - name: Setup .NET Core SDK | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '8.0.x' #'3.1.x' # .NET Core 3.1 SDK supports .NET Standard 2.0 and 2.1 | |
| - name: Install dependencies | |
| run: dotnet restore ./Source/NovusCodeLibrary.sln | |
| - name: Build the project | |
| run: dotnet build ./Source/NovusCodeLibrary.sln --configuration Release --no-restore | |
| - name: Publish to NuGet | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| run: | | |
| dotnet pack ./Source/NovusCodeLibrary.sln --configuration Release --no-build --output ./nupkg | |
| dotnet nuget push "./nupkg/*.nupkg" --api-key $NUGET_API_KEY --source https://api.nuget.org/v3/index.json | |
| #- name: Run tests (optional) | |
| # run: dotnet test NovuscodeLibrary.NET/Source/NovusCodeLibrary.sln --configuration Release --no-build --verbosity normal |