Skip to content

Update dotnet.yml

Update dotnet.yml #7

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "master" ]
tags:
- '*'
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Setup .NET
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.x.x
- name: Restore dependencies
run: dotnet restore
- name: Build (Release)
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Test (Release)
run: dotnet test --configuration Release --no-build --no-restore
- name: Pack (Release)
run: dotnet pack --configuration Release --output .\nuget --no-build --no-restore
- name: Publish
if: github.event_name == 'push'
run: |
if [[ ${{github.ref}} =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+$ ]]
then
dotnet nuget push ./nuget/*.nupkg -s nuget.org -k ${{secrets.NUGET_TOKEN}} --skip-duplicate
else
echo "publish is only enabled by tagging with a release tag"
fi