Publish Nuget Package #17
This file contains hidden or 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: Publish Nuget Package | ||
| on: | ||
| workflow_dispatch: | ||
| jobs: | ||
| build: | ||
| name: Build on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: "9.x" | ||
| - name: Clone TypeTreeGeneratorAPI | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| repository: jakobhellermann/TypeTreeGeneratorAPI | ||
| submodules: true | ||
| ref: wip | ||
| path: TypeTreeGeneratorAPI | ||
| - name: Publish TypeTreeGeneratorAPI with dotnet | ||
| run: dotnet publish TypeTreeGeneratorAPI/TypeTreeGeneratorAPI -o output --use-current-runtime -p:EnableAssetRipper=false -p:EnableAssetStudio=false -p:EnableAssetsTools=true -p:EnableIL2CPP=false | ||
| - name: Copy importlib to output | ||
| if: runner.os == windows | ||
|
Check failure on line 32 in .github/workflows/nuget-release.yml
|
||
| run: cp TypeTreeGeneratorAPI/TypeTreeGeneratorAPI/bin/Release/net9.0/win-x64/native/TypeTreeGeneratorAPI.lib ./output | ||
| - name: Build bindings | ||
| env: | ||
| RUSTFLAGS: "-L output" | ||
| LD_LIBRARY_PATH: "${{ github.workspace }}/output" | ||
| run: cargo build --release -p bindings | ||
| - name: Copy artifacts | ||
| shell: bash | ||
| run: | | ||
| if [[ "${{ runner.os }}" == "Windows" ]]; then | ||
| cp target/release/unityscenerepacker.dll output/unityscenerepacker.dll | ||
| elif [[ "${{ runner.os }}" == "macOS" ]]; then | ||
| cp target/release/libunityscenerepacker.dylib output/libunityscenerepacker.dylib | ||
| else | ||
| cp target/release/libunityscenerepacker.so output/libunityscenerepacker.so | ||
| fi | ||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: bindings-${{ matrix.os }} | ||
| path: output/* | ||
| nuget: | ||
| name: Pack and Push NuGet Package | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - run: sudo apt install mono-devel # https://github.com/NuGet/setup-nuget/issues/168 | ||
| - uses: nuget/setup-nuget@v2 | ||
| - name: Download artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: bindings-* | ||
| merge-multiple: true | ||
| path: target/release | ||
| - name: List built files | ||
| run: ls -R target/release | ||
| - name: Pack NuGet package | ||
| run: nuget pack ./bindings/nuget/unityscenerepacker.nuspec | ||
| - name: Push to NuGet | ||
| env: | ||
| NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | ||
| run: nuget push unityscenerepacker.*.nupkg -Source https://api.nuget.org/v3/index.json -ApiKey $NUGET_API_KEY | ||