Add support for .NET 8 #28
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Package | |
on: | |
push: | |
branches: | |
- main | |
- release/* | |
paths-ignore: | |
- '**.yml' | |
- 'CODEOWNERS' | |
pull_request: | |
branches: | |
- main | |
- release/* | |
paths-ignore: | |
- 'CODEOWNERS' | |
jobs: | |
build-and-test: | |
name: Build and Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Checkout all history for GitVersion to be able to calculate the version | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0 | |
with: | |
versionSpec: '5.x' | |
- name: Determine Version | |
id: gitversion # id to later be referenced | |
uses: gittools/actions/gitversion/execute@v0 | |
with: | |
useConfigFile: true | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Test | |
run: dotnet test --configuration Release --no-build | |
- name: Pack | |
run: dotnet pack --configuration Release /p:Version=${{ steps.gitversion.outputs.nuGetVersionV2 }} | |
- name: Upload package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: nuget-package | |
path: '**/*.nupkg' | |
publish: | |
name: Publish Package | |
runs-on: ubuntu-latest | |
needs: build-and-test | |
if: github.event_name == 'push' | |
permissions: | |
packages: write | |
steps: | |
- name: Download package | |
uses: actions/download-artifact@v3 | |
with: | |
name: nuget-package | |
path: ./packages | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Authenticate to GitHub Packages | |
run: dotnet nuget add source --username $GITHUB_REPOSITORY_OWNER --password ${API_KEY} --store-password-in-clear-text --name "github" "https://nuget.pkg.github.com/$GITHUB_REPOSITORY_OWNER/index.json" | |
env: | |
API_KEY: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish package to GitHub Packages | |
run: dotnet nuget push "**/*.nupkg" -k ${API_KEY} --source "github" | |
env: | |
API_KEY: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish package to NuGet | |
run: dotnet nuget push "**/*.nupkg" -k ${API_KEY} --source "https://api.nuget.org/v3/index.json" | |
env: | |
API_KEY: ${{ secrets.NUGET_TOKEN }} |