Skip to content

ci/cd

ci/cd #3

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: [ "v*" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }} # checkout the correct branch name
fetch-depth: 0
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0.9.7
with:
versionSpec: '5.x'
- name: Determine Version
uses: gittools/actions/gitversion/execute@v0.9.7
with:
useConfigFile: true
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build
run: dotnet build -c Release -p:Version=$GITVERSION_NUGETVERSION
- name: Test
run: dotnet test --no-build -c Release --verbosity normal
- name: Pack
run: dotnet pack --no-build -o ./ -p:Version=$GITVERSION_NUGETVERSION
- name: Push
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key $APIKey
env:
APIKey: ${{ secrets.NUGETKEY }}