Enhance .NET workflow with branch and tag support #91
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 and deploy | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| tags: | |
| - 'release/v*' | |
| pull_request: {} | |
| workflow_dispatch: | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Restore | |
| run: dotnet restore | |
| - name: Build | |
| run: dotnet build --configuration Release --no-restore | |
| - name: Pack | |
| run: dotnet pack --no-build --configuration Release PAYNLSDK/PayNLSdk.csproj --output . | |
| - name: Push Nuget | |
| if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/release/v') }} | |
| env: | |
| NUGET_API_KEY: ${{ secrets.NUGET_PUBLISH_KEY }} | |
| run: | | |
| dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" --skip-duplicate | |
| dotnet nuget push *.snupkg --source https://api.nuget.org/v3/index.json --api-key "$NUGET_API_KEY" --skip-duplicate |