.NET Build and Publish Nuget #20
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 | |
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 | |
# Stride.CommunityToolkit | |
- name: Restore dependencies - Stride.CommunityToolkit | |
run: dotnet restore ${{ env.PROJECT_PATH_CORE }} | |
- 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 | |
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.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 | |
# 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 }} |