Merge pull request #13 from ForEvolve/issues/11-Migrate-build-jobs-to… #57
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 Deploy | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'samples/**' | |
pull_request: | |
branches: | |
- master | |
workflow_dispatch: | |
inputs: | |
deployToFeedz: | |
description: 'Deploy the libraries to feedz.io' | |
required: false | |
default: 'false' | |
deployToNuGet: | |
description: 'Deploy the libraries to NuGet.org' | |
required: false | |
default: 'false' | |
env: | |
BUILD_CONFIGURATION: Release | |
# ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.x | |
7.x | |
8.x | |
- name: Build | |
run: dotnet build -c ${{ env.BUILD_CONFIGURATION }} | |
- name: Unit Test | |
run: dotnet test -c ${{ env.BUILD_CONFIGURATION }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build-and-test | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
6.x | |
7.x | |
8.x | |
- uses: dotnet/nbgv@master | |
with: | |
setAllVars: true | |
- name: Pack | |
run: dotnet pack -c ${{ env.BUILD_CONFIGURATION }} | |
- name: Push to feedz.io | |
run: dotnet nuget push **/*.nupkg -k ${{ secrets.FEEDZ_API_KEY }} -s https://f.feedz.io/forevolve/exception-mapper/nuget/index.json | |
if: ${{ github.event.inputs.deployToFeedz == 'true' || github.event_name == 'pull_request' }} | |
- name: Push to NuGet.org | |
run: dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json | |
if: ${{ github.event.inputs.deployToNuGet == 'true' || github.event_name == 'push' }} |