Skip to content

Update dotnet.yml

Update dotnet.yml #207

Workflow file for this run

name: .NET
on:
pull_request: # Trigger on pull request events
branches: [ "master" ]
push: # Additionally trigger on push events
branches: [ "master" ]
jobs:
build-and-test: # Runs on pull request and push to master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
nuget: # Runs only on successful merge (pull request closed) or push to master
runs-on: ubuntu-latest
if: (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) || (github.event_name == 'push' && github.base_branch == 'master') # Merge condition
steps:
- uses: actions/checkout@v3
- name: Setup .NET 8
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Publish
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
run: chmod +x scripts/pack.sh && scripts/pack.sh
shell: bash