|
| 1 | +name: LSL.Net |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: '*' |
| 7 | + workflow_dispatch: |
| 8 | + release: |
| 9 | + types: [ published ] |
| 10 | + |
| 11 | +jobs: |
| 12 | + build: |
| 13 | + name: Build-${{ matrix.os }} |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + os: [ ubuntu-latest, windows-latest, macOS-latest ] |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Install .NET SDK |
| 24 | + uses: actions/setup-dotnet@v4 |
| 25 | + with: |
| 26 | + dotnet-version: | |
| 27 | + 5.0.x |
| 28 | + 6.0.x |
| 29 | +
|
| 30 | + - name: List installed .NET SDKs |
| 31 | + run: dotnet --list-sdks |
| 32 | + |
| 33 | + - name: Build |
| 34 | + run: dotnet build -c Release LSL.Net.sln |
| 35 | + |
| 36 | + - name: Pack |
| 37 | + run: dotnet pack -c Release src/LSL.Net.slnf |
| 38 | + |
| 39 | + - name: Setup library path |
| 40 | + if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }} |
| 41 | + run: | |
| 42 | + echo ${{ github.workspace }} |
| 43 | + uname -a |
| 44 | + if [[ "$OSTYPE" == "darwin"* ]]; then |
| 45 | + echo "DYLD_LIBRARY_PATH=${{ github.workspace }}/examples/LSLVer/bin/Release/net6.0" >> "$GITHUB_ENV" |
| 46 | + else |
| 47 | + echo "LD_LIBRARY_PATH=${{ github.workspace }}/examples/LSLVer/bin/Release/net6.0" >> "$GITHUB_ENV" |
| 48 | + fi |
| 49 | +
|
| 50 | + - name: Run LSLVer |
| 51 | + # LSL.Net.runtime for linux and macOS is not yet landed. |
| 52 | + if: ${{ runner.os == 'Windows' }} |
| 53 | + run: dotnet run -c Release -p examples/LSLVer/LSLVer.csproj -f net6.0 |
| 54 | + |
| 55 | + - name: Upload build artifacts |
| 56 | + if: ${{ runner.os == 'Linux' }} |
| 57 | + uses: actions/upload-artifact@v4 |
| 58 | + with: |
| 59 | + name: nuget-packages |
| 60 | + path: "**/*.*nupkg" |
| 61 | + |
| 62 | + publish: |
| 63 | + name: Publish |
| 64 | + runs-on: ubuntu-latest |
| 65 | + needs: build |
| 66 | + if: github.event_name == 'release' |
| 67 | + steps: |
| 68 | + - name: Install .NET SDK |
| 69 | + uses: actions/setup-dotnet@v4 |
| 70 | + |
| 71 | + - name: Download artifacts |
| 72 | + uses: actions/download-artifact@v4 |
| 73 | + with: |
| 74 | + name: nuget-packages |
| 75 | + |
| 76 | + - name: Push NuGet packages |
| 77 | + run: | |
| 78 | + dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |
| 79 | +
|
| 80 | + - name: Release |
| 81 | + uses: softprops/action-gh-release@v2 |
| 82 | + env: |
| 83 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 84 | + with: |
| 85 | + generate_release_notes: true |
| 86 | + files: | |
| 87 | + **/*.nupkg |
| 88 | + **/*.snupkg |
0 commit comments