Skip to content

Updated actions/checkout and actions/setup-dotnet to v4 #33

Updated actions/checkout and actions/setup-dotnet to v4

Updated actions/checkout and actions/setup-dotnet to v4 #33

Workflow file for this run

name: build
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Install dependencies
run: dotnet restore
- name: Check for vulnerable packages
shell: bash
run: |
set -e # This will cause the script to exit on the first error
OUTPUT=$(dotnet list src/Elmah.Io.AspNetCore.Log4Net/Elmah.Io.AspNetCore.Log4Net.csproj package --vulnerable)
echo "$OUTPUT"
if echo "$OUTPUT" | grep -q 'no vulnerable packages'; then
echo "No vulnerable packages found"
else
if echo "$OUTPUT" | grep -q 'vulnerable'; then
echo "Vulnerable packages found"
exit 1
fi
fi
OUTPUT=$(dotnet list src/Elmah.Io.Log4Net/Elmah.Io.Log4Net.csproj package --vulnerable)
echo "$OUTPUT"
if echo "$OUTPUT" | grep -q 'no vulnerable packages'; then
echo "No vulnerable packages found"
else
if echo "$OUTPUT" | grep -q 'vulnerable'; then
echo "Vulnerable packages found"
exit 1
fi
fi
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Test
run: dotnet test --no-restore --verbosity normal
- name: Pack Elmah.Io.Log4Net
run: dotnet pack --configuration Release src/Elmah.Io.Log4Net/Elmah.Io.Log4Net.csproj /p:Version=5.1.${{ github.run_number }}-pre
- name: Pack Elmah.Io.AspNetCore.Log4Net
run: dotnet pack --configuration Release src/Elmah.Io.AspNetCore.Log4Net/Elmah.Io.AspNetCore.Log4Net.csproj /p:Version=5.1.${{ github.run_number }}-pre
- name: Install dotnet-validate
run: dotnet tool install --global dotnet-validate --version 0.0.1-preview.304
- name: Validate Elmah.Io.Log4Net
run: dotnet-validate package local src/Elmah.Io.Log4Net/bin/Release/Elmah.Io.Log4Net.5.1.${{ github.run_number }}-pre.nupkg
- name: Validate Elmah.Io.AspNetCore.Log4Net
run: dotnet-validate package local src/Elmah.Io.AspNetCore.Log4Net/bin/Release/Elmah.Io.AspNetCore.Log4Net.5.1.${{ github.run_number }}-pre.nupkg
- name: Push Elmah.Io.Log4Net to nuget.org
run: dotnet nuget push src/Elmah.Io.Log4Net/bin/Release/Elmah.Io.Log4Net.5.1.${{ github.run_number }}-pre.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
if: ${{ github.event_name == 'push' }}
- name: Push Elmah.Io.AspNetCore.Log4Net to nuget.org
run: dotnet nuget push src/Elmah.Io.AspNetCore.Log4Net/bin/Release/Elmah.Io.AspNetCore.Log4Net.5.1.${{ github.run_number }}-pre.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
if: ${{ github.event_name == 'push' }}