Try to do some transitive stuff maybe #19
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 Natives | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
paths: | |
- lib/** | |
- src/Raylib.NET.Native/** | |
jobs: | |
natives: | |
strategy: | |
matrix: | |
# TODO: add linx-arm64, probs needs separate runner | |
runtime: [linux-x64, browser-wasm, osx-x64, osx-arm64, win-x64, win-x86, win-arm64] | |
config: [Debug, Release] | |
include: | |
- runtime: linux-x64 | |
os: ubuntu-latest | |
- runtime: browser-wasm | |
os: ubuntu-latest | |
- runtime: osx-x64 | |
os: macos-latest | |
- runtime: osx-arm64 | |
os: macos-latest | |
- runtime: win-x64 | |
os: windows-latest | |
- runtime: win-x86 | |
os: windows-latest | |
- runtime: win-arm64 | |
os: windows-latest | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup Environment | |
if: matrix.os == 'ubuntu-latest' | |
shell: bash | |
run: | | |
sudo apt-get update -qq | |
sudo apt-get install \ | |
gcc-multilib \ | |
libasound2-dev \ | |
libx11-dev \ | |
libxrandr-dev \ | |
libxi-dev \ | |
libgl1-mesa-dev \ | |
libglu1-mesa-dev \ | |
libxcursor-dev \ | |
libxinerama-dev \ | |
libwayland-dev \ | |
libxkbcommon-dev | |
- name: Install wasm-tools | |
if: matrix.runtime == 'browser-wasm' | |
run: | | |
dotnet workload install wasm-tools | |
- name: Setup EMSDK | |
if: matrix.runtime == 'browser-wasm' | |
uses: mymindstorm/setup-emsdk@v14 | |
with: | |
actions-cache-folder: 'emsdk-cache' | |
- name: Build Natives | |
run: dotnet build -c ${{ matrix.config }} -r ${{ matrix.runtime }} | |
working-directory: src/Raylib.NET.Native | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: natives-${{ matrix.config }}-${{ matrix.runtime }} | |
path: src/Raylib.NET.Native/bin/${{ matrix.config }}/runtimes/** | |
if-no-files-found: error | |
upload-packages: | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
needs: | |
- natives | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Download Debug Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: natives-Debug-* | |
path: src/Raylib.NET.Native/bin/Debug/runtimes | |
merge-multiple: true | |
- name: Download Release Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: natives-Release-* | |
path: src/Raylib.NET.Native/bin/Release/runtimes | |
merge-multiple: true | |
- name: Generate NuGet Version | |
id: package-info | |
run: | | |
echo "version=dev-$(git rev-list --count HEAD)" >> $GITHUB_OUTPUT | |
- name: Create NuGet Debug Packages | |
run: dotnet pack src/Raylib.NET.Native -c Debug --output nuget -p:SkipNatives=true -p:SkipBindgen=true -p:VersionSuffix=${{ steps.package-info.outputs.version }} | |
- name: Create NuGet Release Packages | |
run: dotnet pack src/Raylib.NET.Native -c Release --output nuget -p:SkipNatives=true -p:SkipBindgen=true -p:VersionSuffix=${{ steps.package-info.outputs.version }} | |
- name: Upload NuGet Packages As Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nuget-packages | |
path: nuget/* | |
- name: Publish NuGet Packages to GitHub Packages | |
run: dotnet nuget push nuget/*.nupkg -s https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -k ${{ secrets.GITHUB_TOKEN }} --skip-duplicate |