Skip to content

amend pipeline

amend pipeline #119

name: .NET
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
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: Add GitHub NuGet Source
run: dotnet nuget add source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --name github --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
- name: Restore dependencies
run: dotnet restore src/ChristopherBriddock.SortingAlgorithms.sln
- name: Build
run: dotnet build --configuration Release --no-restore src/ChristopherBriddock.SortingAlgorithms.sln -p:PackageVersion=${{ secrets.RELEASE_VERSION }}
- name: Test
run: dotnet test --configuration Release --no-build src/ChristopherBriddock.SortingAlgorithms.Tests/ChristopherBriddock.SortingAlgorithms.Tests.csproj --logger trx --results-directory TestResults
- name: Upload Test Results
uses: actions/upload-artifact@v4
with:
name: test-results
path: TestResults/*.trx
if-no-files-found: error
- name: Pack NuGet package
run: dotnet pack --configuration Release --no-build src/ChristopherBriddock.SortingAlgorithms/ChristopherBriddock.SortingAlgorithms.csproj -p:PackageVersion=${{ secrets.RELEASE_VERSION }} -o out
- name: Upload Build Artifact
uses: actions/upload-artifact@v4
with:
name: nuget-package
path: out/*.nupkg
if-no-files-found: error
- name: Push NuGet package to GitHub Packages
run: dotnet nuget push "out/*.nupkg" --source "github" --skip-duplicate
env:
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}