Potential build fix #252
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: 'Server (C#)' | |
on: | |
push: | |
paths-ignore: | |
- '.github/workflows/web-assets.yml' | |
- 'WebAssets/**' | |
- '*.Demo*/**/*.cs' | |
- '*.Demo*/**/*.css' | |
- '*.Demo*/**/*.html' | |
- '*.Demo*/**/package.json' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build-and-publish: | |
name: 'Build and Publish' | |
runs-on: windows-latest | |
env: | |
NUGET_PACKAGES: ${{github.workspace}}/.nuget/packages | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
2.1.x | |
3.1.x | |
7.0.x | |
# https://github.com/actions/setup-dotnet/issues/155#issuecomment-748452076 | |
- run: dotnet nuget locals all --clear | |
- uses: actions/cache@v4 | |
with: | |
path: ${{github.workspace}}/.nuget/packages | |
key: ${{runner.os}}-nuget-${{hashFiles('**/packages.lock.json')}} | |
restore-keys: | | |
${{runner.os}}-nuget- | |
- run: dotnet build --configuration Release | |
- run: dotnet test --no-build --configuration Release | |
- run: dotnet pack --no-build --output . --configuration Release | |
- if: github.ref == 'refs/heads/main' | |
run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_TOKEN}} --skip-duplicate | |
- if: github.ref == 'refs/heads/main' | |
uses: actions/upload-artifact@v4 | |
with: | |
path: '*.nupkg' |