Skip to content

Bump actions/setup-dotnet from 4 to 5 #132

Bump actions/setup-dotnet from 4 to 5

Bump actions/setup-dotnet from 4 to 5 #132

# 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: Build & Release & Test & Publish
on:
pull_request: {}
push:
branches:
- main
release:
types:
- published
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x
source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --configuration Release --no-build --verbosity normal
- name: Pack
run: dotnet pack --configuration Release --no-build --output pack/
- name: Store .NET Package
uses: actions/upload-artifact@v4
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: pack/*.nupkg
- name: Publish .NET Solution to GitHub Packages
continue-on-error: false
run: dotnet nuget push pack/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
if: ${{ github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }}
- name: Publish .NET Solution to NuGet.org
continue-on-error: false
run: dotnet nuget push pack/*.nupkg --api-key ${{ secrets.NUGET_ORG_KEY }} --source nuget
if: ${{ github.event_name == 'release' && github.ref_type == 'tag' || github.event.release.tag_name }}