amnd pipeline. #118
This file contains hidden or 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: .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 | |
- 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 }} |