GitHub: Added CI workflow #3
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: CD | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Publish | |
runs-on: windows-latest | |
environment: NuGet | |
strategy: | |
fail-fast: false | |
matrix: | |
configuration: [Release] | |
platform: [Any CPU] | |
env: | |
WORKING_DIR: ${{ github.workspace }} | |
SOLUTION_PATH: '${{ github.workspace }}\CubeKit.sln' | |
HEAD_PROJECTS_DIR: '${{ github.workspace }}\src\platforms' | |
HEAD_EXTENSIONS_DIR: '${{ github.workspace }}\src\extensions' | |
CONFIGURATION: ${{ matrix.configuration }} | |
ARCHITECTURE: ${{ matrix.platform }} | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v2 | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 9.x | |
- name: Restore project | |
shell: pwsh | |
run: | | |
msbuild $env:SOLUTION_PATH ` | |
-t:Restore ` | |
-p:Platform=$env:ARCHITECTURE ` | |
-p:Configuration=$env:CONFIGURATION | |
- name: Build CubeKit | |
run: | | |
msbuild "$env:SOLUTION_PATH" ` | |
-t:Build ` | |
-p:Platform=$env:ARCHITECTURE ` | |
-p:Configuration=$env:CONFIGURATION | |
- name: Package CubeKit | |
run: dotnet pack ${{ env.PACKAGE_PROJECT_PATH }} --configuration Release --no-build -o ./output | |
- name: Publish package to NuGet | |
run: dotnet nuget push ./output/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json | |
# TODO: Publish symbols as well |