nino v2.0.8 #1
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, Test, and Publish NuGet Packages | |
on: | |
push: | |
branches: | |
- release | |
tags: | |
- 'v*' | |
# Set global defaults, including the working directory | |
defaults: | |
run: | |
working-directory: ./src # Default working directory for all jobs and steps | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Set up .NET Core using the repository-level DOTNET_VERSION environment variable | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ vars.DOTNET_VERSION }} # Using repository-level environment variable | |
# Restore dependencies | |
- name: Restore dependencies | |
run: dotnet restore | |
# Build the solution | |
- name: Build solution | |
run: dotnet build --configuration Release --output ./artifacts | |
# Upload build artifacts | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifacts | |
path: ./artifacts | |
test: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
# Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Set up .NET Core using the repository-level DOTNET_VERSION environment variable | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ vars.DOTNET_VERSION }} | |
# Run tests | |
- name: Run tests | |
run: dotnet test --configuration Release --no-build | |
push-to-nuget: | |
runs-on: ubuntu-latest | |
needs: [build, test] | |
steps: | |
# Checkout the code | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Set up .NET Core using the repository-level DOTNET_VERSION environment variable | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ vars.DOTNET_VERSION }} | |
# Download build artifacts | |
- name: Download build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: artifacts | |
# Push NuGet packages | |
- name: Push NuGet Packages | |
run: | | |
for package in ./artifacts/*.nupkg; do | |
dotnet nuget push "$package" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
done |