Use solution filter #118
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: SharpLSL | |
on: | |
push: | |
pull_request: | |
types: [ opened, ready_for_review, reopened, synchronize ] | |
workflow_dispatch: | |
env: | |
DOTNET_VERSION: 6.0.x | |
# Disable the .NET logo in the console output. | |
DOTNET_NOLOGO: true | |
# Disable the .NET first time experience to skip caching NuGet packages and speed up the build. | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
# Disable sending .NET CLI telemetry to Microsoft. | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
# Set the build number in MinVer. | |
MINVERBUILDMETADATA: build.${{ github.run_number }} | |
jobs: | |
build: | |
name: Build-${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, windows-latest, macOS-latest ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET SDK | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: ${{ env.DOTNET_VERSION }} | |
- name: List installed .NET SDKs | |
run: dotnet --list-sdks | |
- name: Build SharpLSL | |
run: dotnet build ./SharpLSL.Full.sln -c Release | |
- name: Run example | |
run: dotnet run --project ./Examples/GetLocalClock/GetLocalClock.csproj -c Release | |
- name: Run unit tests | |
run: dotnet test -c Release | |
- name: Pack SharpLSL | |
run: dotnet pack ./Source/SharpLSL.sln -c Release --no-build | |
- name: Upload artifacts | |
if: ${{ runner.os == 'Windows' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nuget-packages | |
path: "**/*.*nupkg" | |
publish: | |
name: Publish | |
runs-on: ubuntu-latest | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@v2 | |
with: | |
nuget-version: latest | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: nuget-packages | |
- name: Push NuGet packages | |
run: | | |
dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
generate_release_notes: true | |
files: | | |
**/*.nupkg | |
**/*.snupkg |