Merge pull request #34 from begeistert/chore/fluentassertions-6 #3
Workflow file for this run
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: Publish NuGet | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| # Versioning is handled by MinVer (Directory.Build.props): a `v*` tag produces a | |
| # stable release version, any other ref produces a preview version derived from | |
| # the last tag + commit height. Packages are always built and uploaded as a | |
| # workflow artifact; they are pushed to nuget.org only for `v*` tags (or when a | |
| # manual run sets push_public=true). Compatible with GitHub and Gitea runners. | |
| # ───────────────────────────────────────────────────────────────────────────── | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| push_public: | |
| description: "Push to nuget.org as well? (otherwise pack + artifact only)" | |
| required: false | |
| default: "false" | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # ── Checkout ──────────────────────────────────────────────────────────── | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # MinVer derives the version from the full tag history | |
| # ── .NET setup ────────────────────────────────────────────────────────── | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: "10.0.x" | |
| # ── Restore ───────────────────────────────────────────────────────────── | |
| - name: Restore | |
| run: dotnet restore RP2040.sln | |
| # ── Build ─────────────────────────────────────────────────────────────── | |
| - name: Build | |
| run: dotnet build RP2040.sln -c Release --no-restore /p:ContinuousIntegrationBuild=true | |
| # ── Test (unit only; integration tests download firmware) ─────────────── | |
| - name: Test | |
| run: > | |
| dotnet test tests/RP2040Sharp.Tests/RP2040Sharp.Tests.csproj | |
| -c Release | |
| --no-build | |
| --logger "console;verbosity=normal" | |
| # ── Pack ──────────────────────────────────────────────────────────────── | |
| - name: Pack RP2040Sharp | |
| run: > | |
| dotnet pack src/RP2040Sharp/RP2040Sharp.csproj | |
| -c Release | |
| --no-build | |
| --output ./nupkgs | |
| - name: Pack RP2040Sharp.TestKit | |
| run: > | |
| dotnet pack src/RP2040.TestKit/RP2040.TestKit.csproj | |
| -c Release | |
| --no-build | |
| --output ./nupkgs | |
| # ── Push to nuget.org (tags, or a manual push_public run) ─────────────── | |
| - name: Push to nuget.org | |
| env: | |
| API_KEY: ${{ secrets.NUGET_API_KEY }} | |
| if: > | |
| ${{ github.server_url == 'https://github.com' && | |
| env.API_KEY != '' && | |
| (startsWith(github.ref, 'refs/tags/v') || | |
| github.event.inputs.push_public == 'true') }} | |
| run: > | |
| dotnet nuget push "./nupkgs/*.nupkg" | |
| --source https://api.nuget.org/v3/index.json | |
| --api-key "${{ secrets.NUGET_API_KEY }}" | |
| --skip-duplicate | |
| # ── Always upload the packages as an artifact ─────────────────────────── | |
| - name: Upload NuGet Packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: nupkgs | |
| path: ./nupkgs/*.nupkg | |
| retention-days: 14 | |
| if-no-files-found: error |