Skip to content

Update GH Actions

Update GH Actions #2

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 --no-build --verbosity normal
publish-nuget:
needs: 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'
# 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 nuget add source --name "nuget.org" --source "https://api.nuget.org/v3/index.json"
dotnet pack --configuration Release --no-build --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