Skip to content

Update GH Actions

Update GH Actions #7

Workflow file for this run

name: Build, Test, and Publish
on:
push:
tags:
- 'v*'
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
- name: Install dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --verbosity normal
publish-nuget:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
# Use GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.x'
- name: Determine Version
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: Publish NuGet Package
run: |
dotnet pack --configuration Release --output ./nupkg/
dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source "nuget.org"
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.gitversion.outputs.semVer }}
name: v${{ steps.gitversion.outputs.semVer }}
files: |
./nupkg/*.nupkg