add sln items #13
This file contains 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 and Publish | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' # Matches version tags like v1.0.0 | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
# strategy: | |
# matrix: | |
# dotnet-version: [7.0.x, 8.0.x] # Include .NET 7 and .NET 8 versions | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Run tests | |
run: dotnet test --configuration Release --no-restore --verbosity normal | |
- name: Pack NuGet package | |
run: dotnet pack src/PolygonApi/PolygonApi.csproj --configuration Release --output ./artifacts | |
- name: Publish to NuGet (Pre-release or CI builds) | |
if: github.event_name == 'push' && contains(github.ref, 'refs/heads') | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
- name: Publish to NuGet (Release builds) | |
if: startsWith(github.ref, 'refs/tags') | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |