Update README.md #86
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: Build Raylib-CSharp | |
on: | |
release: | |
types: [ "published" ] | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
raylib_version: '5.0' | |
jobs: | |
# Build for Win | |
build-win: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
name: [win32, x64] | |
# Run | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup .NET | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
# Build Raylib | |
- name: Build Raylib | |
shell: bash | |
run: | | |
curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/${{ env.raylib_version }}.zip | |
unzip -qq raylib.zip | |
cmake -S raylib-${{ env.raylib_version }} \ | |
-A ${{ matrix.name }} \ | |
-B native \ | |
-D CMAKE_BUILD_TYPE=Release \ | |
-D BUILD_SHARED_LIBS=ON \ | |
-D BUILD_EXAMPLES=OFF \ | |
-D CUSTOMIZE_BUILD=ON \ | |
-D SUPPORT_GIF_RECORDING=OFF \ | |
-D SUPPORT_SCREEN_CAPTURE=OFF | |
cmake --build native --config Release | |
# Upload Raylib | |
- name: Upload Raylib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: win-${{ matrix.name }} | |
path: native/raylib/Release/raylib.dll | |
if-no-files-found: error | |
# Build for Linux | |
build-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
name: [x64] | |
# Run | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup .NET | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
# Setup dependencies | |
- name: Setup dependencies | |
run: | | |
sudo apt-get install -y \ | |
libasound2-dev \ | |
libxrandr-dev \ | |
libx11-dev \ | |
libxi-dev \ | |
libgl1-mesa-dev \ | |
libglu1-mesa-dev \ | |
libxcursor-dev \ | |
libxinerama-dev | |
# Build Raylib | |
- name: Build Raylib | |
run: | | |
curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/${{ env.raylib_version }}.zip | |
unzip -qq raylib.zip | |
cmake -S raylib-${{ env.raylib_version }} \ | |
-B native \ | |
-D CMAKE_BUILD_TYPE=Release \ | |
-D BUILD_SHARED_LIBS=ON \ | |
-D BUILD_EXAMPLES=OFF \ | |
-D CUSTOMIZE_BUILD=ON \ | |
-D SUPPORT_GIF_RECORDING=OFF \ | |
-D SUPPORT_SCREEN_CAPTURE=OFF | |
cmake --build native --config Release | |
# Upload Raylib | |
- name: Upload Raylib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-${{ matrix.name }} | |
path: native/raylib/libraylib.so | |
if-no-files-found: error | |
# Build for OSX | |
build-osx: | |
runs-on: macos-latest | |
strategy: | |
matrix: | |
name: [arm64, x86_64] | |
# Run | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup .NET | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
# Build Raylib | |
- name: Build Raylib | |
run: | | |
curl -Lso raylib.zip https://github.com/raysan5/raylib/archive/refs/tags/${{ env.raylib_version }}.zip | |
unzip -qq raylib.zip | |
cmake -S raylib-${{ env.raylib_version }} \ | |
-B native \ | |
-D CMAKE_BUILD_TYPE=Release \ | |
-D CMAKE_OSX_ARCHITECTURES=${{ matrix.name }} \ | |
-D BUILD_SHARED_LIBS=ON \ | |
-D BUILD_EXAMPLES=OFF \ | |
-D CUSTOMIZE_BUILD=ON \ | |
-D SUPPORT_GIF_RECORDING=OFF \ | |
-D SUPPORT_SCREEN_CAPTURE=OFF | |
cmake --build native --config Release | |
# Upload Raylib | |
- name: Upload Raylib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: osx-${{ matrix.name }} | |
path: native/raylib/libraylib.dylib | |
if-no-files-found: error | |
# Publish to NuGet | |
publish-nuget: | |
runs-on: ubuntu-latest | |
needs: [build-win, build-linux, build-osx] | |
# Run | |
steps: | |
- uses: actions/checkout@v4 | |
# Setup .NET | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
# Setup dependencies | |
- name: Setup dependencies | |
run: | | |
sudo apt-get install -y \ | |
libasound2-dev \ | |
libxrandr-dev \ | |
libx11-dev \ | |
libxi-dev \ | |
libgl1-mesa-dev \ | |
libglu1-mesa-dev \ | |
libxcursor-dev \ | |
libxinerama-dev | |
# Windows x86 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: win-win32 | |
path: src/Raylib-CSharp/runtimes/win-x86/native | |
# Windows x64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: win-x64 | |
path: src/Raylib-CSharp/runtimes/win-x64/native | |
# Linux x64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: linux-x64 | |
path: src/Raylib-CSharp/runtimes/linux-x64/native | |
# OSX arm64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: osx-arm64 | |
path: src/Raylib-CSharp/runtimes/osx-arm64/native | |
# OSX x64 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: osx-x86_64 | |
path: src/Raylib-CSharp/runtimes/osx-x64/native | |
# Build and pack NuGet package | |
- name: Build and pack NuGet package | |
if: github.event_name == 'release' | |
run: dotnet pack src/Raylib-CSharp -p:PackageVersion=${{ github.event.release.tag_name }} --configuration Release --output nuget | |
# Publish NuGet package | |
- name: Publish NuGet package | |
if: github.event_name == 'release' | |
run: dotnet nuget push nuget/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |