.NET Build and Publish Nuget #47
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: .NET Build and Publish Nuget | |
env: | |
PROJECT_PATH_CORE: src/Stride.CommunityToolkit/Stride.CommunityToolkit.csproj | |
PROJECT_PATH_SKYBOX: src/Stride.CommunityToolkit.Skyboxes/Stride.CommunityToolkit.Skyboxes.csproj | |
PROJECT_PATH_WINDOWS: src/Stride.CommunityToolkit.Windows/Stride.CommunityToolkit.Windows.csproj | |
PROJECT_PATH_BEPU: src/Stride.CommunityToolkit.Bepu/Stride.CommunityToolkit.Bepu.csproj | |
PROJECT_PATH_IMGUI: src/Stride.CommunityToolkit.ImGui/Stride.CommunityToolkit.ImGui.csproj | |
COMMON_SETTINGS_PATH: src/CommonSettings.props | |
VERSION: "1.0.0.0-preview.${{ github.run_number }}" | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Stride Community Toolkit | |
uses: actions/checkout@v4 | |
- name: .NET Setup | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Set Version in csproj | |
run: | | |
$settingsContent = Get-Content -Path ${{ env.COMMON_SETTINGS_PATH }} -Raw | |
$updatedCsprojContent = $settingsContent -replace '<Version>.*?</Version>', "<Version>${{ env.VERSION }}</Version>" | |
Set-Content -Path ${{ env.COMMON_SETTINGS_PATH }} -Value $updatedCsprojContent | |
# Not needed as Directory.Build.props added a condition to this target | |
# - name: Create .sarif Directory | |
# run: New-Item -ItemType Directory -Force -Path D:\.sarif | |
# shell: pwsh | |
# Stride.CommunityToolkit | |
- name: Restore dependencies - Stride.CommunityToolkit | |
run: dotnet restore ${{ env.PROJECT_PATH_CORE }} | |
# Temporary solution, because of System.Security.Cryptography.Pkcs not found issue | |
# - name: Modify Stride.Core.Assets.CompilerApp.targets | |
# shell: pwsh | |
# run: | | |
# $targetsPath = Join-Path -Path (Get-ChildItem -Path "${env:USERPROFILE}\.nuget\packages\stride.core.assets.compilerapp\4.2.0.2122\buildTransitive" -Filter "Stride.Core.Assets.CompilerApp.targets" -Recurse).DirectoryName -ChildPath "Stride.Core.Assets.CompilerApp.targets" | |
# [xml]$targetsXml = Get-Content -Path $targetsPath | |
# $namespaceManager = New-Object System.Xml.XmlNamespaceManager($targetsXml.NameTable) | |
# $namespaceManager.AddNamespace("msbuild", "http://schemas.microsoft.com/developer/msbuild/2003") | |
# $targetNode = $targetsXml.SelectSingleNode("//msbuild:Target[@Name='_StridePrepareAssetsForPack']", $namespaceManager) | |
# if ($targetNode -ne $null) | |
# { | |
# $targetNode.SetAttribute("Condition", "false") | |
# $targetsXml.Save($targetsPath) | |
# Write-Host "Modified _StridePrepareAssetsForPack target in Stride.Core.Assets.CompilerApp.targets" | |
# } | |
# else | |
# { | |
# Write-Host "_StridePrepareAssetsForPack target not found in Stride.Core.Assets.CompilerApp.targets" | |
# } | |
- name: Build | |
run: dotnet build ${{ env.PROJECT_PATH_CORE }} --no-restore | |
- name: Test | |
run: dotnet test ${{ env.PROJECT_PATH_CORE }} --no-build --verbosity normal | |
# - name: Publish Stride Community Toolkit | |
# run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}} | |
- name: Publish Stride Community Toolkit | |
uses: alirezanet/[email protected] | |
with: | |
PROJECT_FILE_PATH: ${{ env.PROJECT_PATH_CORE }} | |
VERSION_FILE_PATH: ${{ env.COMMON_SETTINGS_PATH }} | |
NUGET_KEY: ${{secrets.NUGET_API_KEY}} | |
# Stride.CommunityToolkit.Windows | |
- name: Restore dependencies - Stride.CommunityToolkit.Windows | |
run: dotnet restore ${{ env.PROJECT_PATH_WINDOWS }} --runtime win-x64 | |
- name: Build | |
run: dotnet build ${{ env.PROJECT_PATH_WINDOWS }} --no-restore | |
- name: Test | |
run: dotnet test ${{ env.PROJECT_PATH_WINDOWS }} --no-build --verbosity normal | |
- name: Publish Stride Community Toolkit - Windows | |
uses: alirezanet/[email protected] | |
with: | |
PROJECT_FILE_PATH: ${{ env.PROJECT_PATH_WINDOWS }} | |
VERSION_FILE_PATH: ${{ env.COMMON_SETTINGS_PATH }} | |
NUGET_KEY: ${{secrets.NUGET_API_KEY}} | |
TAG_COMMIT: false | |
# Stride.CommunityToolkit.Skyboxes | |
- name: Restore dependencies - Stride.CommunityToolkit.Skyboxes | |
run: dotnet restore ${{ env.PROJECT_PATH_SKYBOX }} | |
- name: Build | |
run: dotnet build ${{ env.PROJECT_PATH_SKYBOX }} --no-restore | |
- name: Test | |
run: dotnet test ${{ env.PROJECT_PATH_SKYBOX }} --no-build --verbosity normal | |
- name: Publish Stride Community Toolkit - Skyboxes | |
uses: alirezanet/[email protected] | |
with: | |
PROJECT_FILE_PATH: ${{ env.PROJECT_PATH_SKYBOX }} | |
VERSION_FILE_PATH: ${{ env.COMMON_SETTINGS_PATH }} | |
NUGET_KEY: ${{secrets.NUGET_API_KEY}} | |
TAG_COMMIT: false | |
# Stride.CommunityToolkit.Bepu | |
- name: Restore dependencies - Stride.CommunityToolkit.Bepu | |
run: dotnet restore ${{ env.PROJECT_PATH_BEPU }} | |
- name: Build | |
run: dotnet build ${{ env.PROJECT_PATH_BEPU }} --no-restore | |
- name: Test | |
run: dotnet test ${{ env.PROJECT_PATH_BEPU }} --no-build --verbosity normal | |
- name: Publish Stride Community Toolkit - Bepu | |
uses: alirezanet/[email protected] | |
with: | |
PROJECT_FILE_PATH: ${{ env.PROJECT_PATH_BEPU }} | |
VERSION_FILE_PATH: ${{ env.COMMON_SETTINGS_PATH }} | |
NUGET_KEY: ${{secrets.NUGET_API_KEY}} | |
TAG_COMMIT: false | |
# Stride.CommunityToolkit.ImGui | |
- name: Restore dependencies - Stride.CommunityToolkit.ImGui | |
run: dotnet restore ${{ env.PROJECT_PATH_IMGUI }} | |
- name: Build | |
run: dotnet build ${{ env.PROJECT_PATH_IMGUI }} --no-restore | |
- name: Test | |
run: dotnet test ${{ env.PROJECT_PATH_IMGUI }} --no-build --verbosity normal | |
- name: Publish Stride Community Toolkit - ImGui | |
uses: alirezanet/[email protected] | |
with: | |
PROJECT_FILE_PATH: ${{ env.PROJECT_PATH_IMGUI }} | |
VERSION_FILE_PATH: ${{ env.COMMON_SETTINGS_PATH }} | |
NUGET_KEY: ${{secrets.NUGET_API_KEY}} | |
TAG_COMMIT: false | |
# Create release | |
- name: Create GitHub Release | |
run: | | |
gh release create ${{ env.VERSION }} --title "v${{ env.VERSION }}" --notes "Release notes for ${{ env.VERSION }}" --draft | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |