Convert CI to GitHub Actions with NuGet publishing; remove package pu… #4
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 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Restore | |
| run: dotnet restore src/NLog.MailKit.sln | |
| - name: Build | |
| run: dotnet build src/NLog.MailKit.sln --configuration Release --no-restore | |
| - name: Test | |
| run: dotnet test src/NLog.MailKit.sln --configuration Release --no-build | |
| - name: Pack | |
| run: dotnet pack src/NLog.MailKit.sln --no-build --configuration Release --output artifacts | |
| - name: Upload nuget package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nupkg | |
| path: artifacts/*.nupkg | |
| - name: NuGet login | |
| if: github.ref == 'refs/heads/master' | |
| uses: NuGet/login@v1 | |
| id: login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| - name: Push to NuGet.org | |
| if: github.ref == 'refs/heads/master' | |
| run: dotnet nuget push artifacts/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate |