Update to latest box2c commit #29
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: CI | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
push-packages: | |
description: 'Push nuget packages' | |
required: true | |
default: 'false' | |
type: boolean | |
use-auto-generated-version: | |
description: 'Use auto-generated version' | |
required: true | |
default: 'true' | |
type: boolean | |
nuget-registry: | |
description: 'NuGet registry' | |
required: true | |
default: 'GitLab' | |
type: choice | |
options: | |
- GitLab | |
- NuGet | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: | | |
3.1.x | |
5.0.x | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Set Version Suffix | |
shell: bash | |
run: | | |
if [ '${{ github.event.inputs.use-auto-generated-version }}' != 'false' ]; then | |
echo "NugetVersionSuffix=-dev-$(date +'%Y-%m-%d-%H-%M-%S')" >> $GITHUB_ENV | |
fi | |
- name: Restore Dependencies | |
shell: bash | |
run: dotnet restore | |
- name: Generate Bindings | |
shell: bash | |
run: dotnet run --project Box2D.NET.Bindgen | |
- name: Build Projects | |
shell: bash | |
run: | | |
dotnet build --property:Deterministic=true -c Debug | |
dotnet build --property:Deterministic=true -c Release | |
- name: Run Tests | |
shell: bash | |
run: dotnet test --no-build --verbosity minimal | |
- name: Pack Nuget Packages | |
shell: bash | |
run: | | |
if [ '${{ github.event.inputs.nuget-registry }}' == 'NuGet' ]; then | |
dotnet pack --no-build --property:NugetVersionSuffix=$NugetVersionSuffix -c Debug | |
dotnet pack --no-build --property:NugetVersionSuffix=$NugetVersionSuffix -c Release | |
else | |
dotnet pack --no-build --property:NugetVersionSuffix=$NugetVersionSuffix --property:DebugType=embedded -c Debug | |
dotnet pack --no-build --property:NugetVersionSuffix=$NugetVersionSuffix --property:DebugType=embedded -c Release | |
fi | |
- name: Upload Artifacts | |
if: matrix.os == 'ubuntu-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Nuget Packages | |
path: | | |
**/Box2D.NET.*.nupkg | |
**/Box2D.NET.*.snupkg | |
- name: Push NuGet Packages | |
if: matrix.os == 'ubuntu-latest' && github.event_name == 'workflow_dispatch' && github.event.inputs.push-packages == 'true' | |
shell: bash | |
run: | | |
if [ '${{ github.event.inputs.nuget-registry }}' == 'GitLab' ]; then | |
dotnet nuget push **/Box2D.NET.*.nupkg --api-key '${{ secrets.GITLAB_ACCESS_TOKEN }}' --source 'https://gitlab.com/api/v4/projects/53993416/packages/nuget/index.json' | |
elif [ '${{ github.event.inputs.nuget-registry }}' == 'NuGet' ]; then | |
dotnet nuget push **/Box2D.NET.*.nupkg --api-key '${{ secrets.NUGET_ACCESS_TOKEN }}' --source 'https://api.nuget.org/v3/index.json' | |
fi |