Skip to content

Merge pull request #52 from RachBreeze/TypoFix #96

Merge pull request #52 from RachBreeze/TypoFix

Merge pull request #52 from RachBreeze/TypoFix #96

Workflow file for this run

name: Build
on:
release:
types: [published]
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
env:
BUILD_CONFIG: "Release"
LogFileName: "test-results.trx"
PROJECT: "./src/Umbraco.Community.CSPManager/Umbraco.Community.CSPManager.csproj"
TESTPROJECT: "./src/Umbraco.Community.CSPManager.Tests/Umbraco.Community.CSPManager.Tests.csproj"
TESTLOGPATH: "./src/Umbraco.Community.CSPManager.Tests/TestResults/"
BUILD_VERSION: ${{ github.event.release.tag_name || '0.0.0' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.x
7.x
8.x
- name: Restore package dependencies
run: nuget restore $PROJECT
- name: Restore test dependencies
run: nuget restore $TESTPROJECT
- name: Build package
run: dotnet build $PROJECT -c $BUILD_CONFIG -p:Version=$BUILD_VERSION --no-restore
- name: Build test
run: dotnet build $TESTPROJECT -c $BUILD_CONFIG -p:Version=$BUILD_VERSION --no-restore
- name: Run tests
run: dotnet test $TESTPROJECT -c $BUILD_CONFIG --no-build --verbosity normal --filter "Category!=LongRunning" --logger "trx;LogFileName=$LogFileName"
- uses: actions/upload-artifact@v3 # upload test results
if: success() || failure() # run this step even if previous step failed
with:
name: test-results
path: "${{env.TESTLOGPATH}}${{env.LogFileName}}"
- name: Publish
if: github.event_name == 'release'
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}