Add from-scratch quickstart tutorial + NuGet publish workflow#19
Merged
Add from-scratch quickstart tutorial + NuGet publish workflow#19
Conversation
The README previously had a "Run the Orders sample" quickstart but no
end-to-end tutorial for spinning up a brand-new service from a blank
repository. This PR adds that tutorial alongside a release-publish
workflow so the packages it tells readers to `dotnet add` actually
resolve once the maintainer cuts a release.
## README — "Build your first Firefly service"
A new section right after the sample quickstart walks the reader from
`dotnet new webapi` to a runnable hello-world service in six numbered
steps:
1. Prerequisites (.NET 10 SDK, curl).
2. `dotnet new webapi -n HelloFirefly` + cleanup.
3. `dotnet add package FireflyFramework.Starter.Core`.
4. A 40-line `Program.cs` showing `AddFireflyCore` + `UseFireflyWeb`,
a minimal `[POST /api/v1/greet]` endpoint, and an in-line CQRS
command + handler exercising the real `ICommand<T>` /
`ICommandHandler<TCommand, TResult>` interfaces from
`FireflyFramework.Cqrs`.
5. `appsettings.json` with the matching `Firefly:*` config.
6. `dotnet run` + a curl that exercises both the happy path and the
`X-Idempotency-Key` replay path.
The section also points to follow-up moves — adding a query, promoting
to the canonical 5-project layout, picking a richer starter — and
links to `docs/SERVICE-SCAFFOLDING.md` and `docs/CONFIGURATION.md`.
A new "Releases & publishing" section right after "Versioning"
describes the CI / publish split: what runs on PR vs. main vs.
release-published, where packages land (NuGet.org + GitHub Packages +
release assets), how to cut a release with `git tag` + `gh release
create`, and how to use `workflow_dispatch` for hotfix / pre-release
cuts.
## Workflows
* `.github/workflows/ci.yml` — bumped `dotnet-version` from `9.0.x`
to `10.0.x` (the projects target `net10.0`; the wrong runtime would
have failed on a fresh runner). Pack job is unchanged: it uploads
every `src/*` `.nupkg` as a workflow artifact for preview, but does
not push.
* `.github/workflows/publish.yml` — new. Triggers on a published
GitHub Release (tag `vX.Y.Z` → package version `X.Y.Z`) or by
manual `workflow_dispatch` with an explicit version. Steps:
1. Setup .NET 10.
2. Resolve the package version (release tag or manual input).
3. Restore + build + test.
4. Upload `.trx` test results as an artifact.
5. `dotnet pack` with `-p:PackageVersion=$VERSION
-p:Version=$VERSION -p:ContinuousIntegrationBuild=true` so the
symbol packages embed the right repo URL.
6. Upload the `.nupkg` + `.snupkg` as a workflow artifact.
7. Push to NuGet.org via `secrets.NUGET_API_KEY` (skipped with a
warning if the secret isn't configured, instead of failing
— useful for first-time setup).
8. Push to GitHub Packages via the workflow's `GITHUB_TOKEN`
(always present, no extra setup).
9. On a release event, attach every produced `.nupkg` + `.snupkg`
to the GitHub Release as downloadable assets.
Both pushes use `--skip-duplicate`, so re-running the workflow on
the same version is a safe no-op.
## Verification
* `dotnet pack FireflyFramework.sln --configuration Release` packs
51 NuGet packages (52 `src/*` projects minus `FireflyFramework.ConfigServer`,
which is an executable Web host with `<IsPackable>false</IsPackable>`).
Sample projects and the test project carry the same opt-out.
* The CQRS interface signatures used in the tutorial code
(`ICommand<out TResult>`, `ICommandHandler<in TCommand, TResult>`,
`HandleAsync(command, context, ct)`) match the real surface in
`src/FireflyFramework.Cqrs/Commands/`.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The README previously had a "Run the Orders sample" quickstart but no end-to-end tutorial for spinning up a brand-new service from scratch. This PR adds that tutorial alongside a release-publish workflow so the packages it tells readers to `dotnet add` actually resolve once the maintainer cuts a release.
README
"Build your first Firefly service" — new section right after the sample quickstart
Walks the reader from `dotnet new webapi` to a runnable hello-world service in six numbered steps:
Plus a follow-up checklist (add a query, promote to the canonical 5-project layout, pick a richer starter) and links to `docs/SERVICE-SCAFFOLDING.md` + `docs/CONFIGURATION.md`.
"Releases & publishing" — new section right after "Versioning"
Documents the CI / publish split, where packages land (NuGet.org + GitHub Packages + release assets), and how to cut a release (`git tag` + `gh release create` for the common path; `workflow_dispatch` for hotfix / pre-release cuts).
Workflows
`.github/workflows/ci.yml` — fix .NET version
Bumped `dotnet-version` from `9.0.x` to `10.0.x`. The projects target `net10.0`; the wrong runtime would have failed on a fresh runner. Pack job is unchanged: it uploads every `src/*` `.nupkg` as a workflow artifact for preview, but does not push to a registry.
`.github/workflows/publish.yml` — new
Triggers on a published GitHub Release (tag `vX.Y.Z` → package version `X.Y.Z`) or by manual `workflow_dispatch` with an explicit version. Steps:
Both pushes use `--skip-duplicate`, so re-running on the same version is a safe no-op.
Verification
Test plan
Maintainer setup (one-time)
To enable NuGet.org publishing, configure a repository secret named `NUGET_API_KEY` at https://github.com/fireflyframework/fireflyframework-dotnet/settings/secrets/actions. Until then, the workflow only pushes to GitHub Packages and attaches `.nupkg` to the release.