Add readme to nuget package #4
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: Build and Publish | |
| on: | |
| push: | |
| branches: [ main, master ] # Adjust if your default branch is different | |
| pull_request: | |
| branches: [ main, master ] | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| env: | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| BUILD_CONFIGURATION: Release | |
| steps: | |
| - name: Calculate version (run_number + 550) | |
| id: version | |
| shell: pwsh | |
| run: | | |
| $number = [int]$env:GITHUB_RUN_NUMBER + 550 | |
| echo "BUILD_VERSION=1.0.$number" >> $env:GITHUB_OUTPUT | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET 10 SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.0.x' | |
| - name: Display .NET version | |
| run: dotnet --version | |
| - name: Restore dependencies | |
| run: dotnet restore ./Cogs.Console.sln --verbosity minimal | |
| - name: Build solution | |
| run: > | |
| dotnet build ./Cogs.Console.sln | |
| --configuration ${{ env.BUILD_CONFIGURATION }} | |
| --verbosity minimal | |
| --no-restore | |
| -p:Version=${{ steps.version.outputs.BUILD_VERSION }} | |
| -p:PackageVersion=${{ steps.version.outputs.BUILD_VERSION }} | |
| -p:AssemblyVersion=${{ steps.version.outputs.BUILD_VERSION }} | |
| -p:FileVersion=${{ steps.version.outputs.BUILD_VERSION }} | |
| -p:InformationalVersion=${{ steps.version.outputs.BUILD_VERSION }} | |
| - name: Pack NuGet packages | |
| run: > | |
| dotnet pack Cogs.Console/Cogs.Console.csproj | |
| --configuration ${{ env.BUILD_CONFIGURATION }} | |
| --no-build | |
| --no-restore | |
| -p:Version=${{ steps.version.outputs.BUILD_VERSION }} | |
| -p:PackageVersion=${{ steps.version.outputs.BUILD_VERSION }} | |
| -p:AssemblyVersion=${{ steps.version.outputs.BUILD_VERSION }} | |
| -p:FileVersion=${{ steps.version.outputs.BUILD_VERSION }} | |
| -p:InformationalVersion=${{ steps.version.outputs.BUILD_VERSION }} | |
| - name: Publish app (creates the publish folder you artifact) | |
| run: > | |
| dotnet publish ./Cogs.Console.sln | |
| --configuration ${{ env.BUILD_CONFIGURATION }} | |
| --no-build | |
| --no-restore | |
| - name: Upload published app as artifact (CogsRelease) | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: CogsRelease | |
| path: Cogs.Console/bin/Release/net10.0/publish/ | |
| if-no-files-found: error | |
| - name: Upload NuGet packages as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: NuGetPackages | |
| path: '**/*.nupkg' | |
| if-no-files-found: warn |