Skip to content

Fix paths on windows #6

Fix paths on windows

Fix paths on windows #6

name: Build and Publish to NuGet
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- '*'
release:
types:
- published
env:
dotnetVerbosity: 'Detailed'
jobs:
build-and-test:
name: Build and Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
artifactName: 'nuget-windows'
- os: macOS-latest
artifactName: 'nuget-macos'
- os: ubuntu-latest
artifactName: 'nuget-linux'
max-parallel: 3
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
- name: Restore dependencies
run: dotnet restore --verbosity ${{ env.dotnetVerbosity }}
- name: Build
run: dotnet build ./src/**/*.csproj --configuration Release --verbosity ${{ env.dotnetVerbosity }}
shell: bash
- name: Test
run: dotnet test ./src/**/*.csproj --configuration Release --verbosity ${{ env.dotnetVerbosity }} --collect "Code coverage"
shell: bash
- name: Pack CI
run: dotnet pack ./src/**/*.csproj --output ./artifacts/ci --configuration Release --verbosity ${{ env.dotnetVerbosity }} /p:VersionSuffix=ci-${{ github.run_number }}
shell: bash
- name: Pack Release
run: dotnet pack ./src/**/*.csproj --output ./artifacts/release --configuration Release --verbosity ${{ env.dotnetVerbosity }}
shell: bash
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifactName }}
path: ./artifacts/
build-samples:
needs: [build-and-test]
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
artifactName: 'samples-windows'
- os: macOS-latest
artifactName: 'samples-macos'
- os: ubuntu-latest
artifactName: 'samples-linux'
max-parallel: 3
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v4
- name: Publish Samples
run: dotnet publish ./samples/**/*.csproj --configuration Release --output ./samples/
shell: bash
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.artifactName }}
path: ./samples/
deploy:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [ build-and-test, build-samples ]
steps:
- uses: actions/download-artifact@v3
with:
name: nuget
path: ./artifacts/
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
- name: Publish NuGet package
run: |
foreach($file in (Get-ChildItem "./artifacts/" -Recurse -Include *.nupkg)) {
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
}