Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 30 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ name: Release
# for the package version and kept for the Docker tag, matching the convention
# previously used by hand (see NOTES.md).
#
# Both the package and the image go to GitHub: GitHub Packages for NuGet and
# GHCR for the container. Neither needs a stored secret — the automatic
# GITHUB_TOKEN authenticates to both, given the packages: write permission the
# jobs below declare.
# The package goes to nuget.org via Trusted Publishing and the image to GHCR.
# Neither uses a long-lived credential:
#
# nuget.org The job requests a GitHub OIDC token, NuGet/login exchanges it for
# an API key valid for one hour, and that key does the push. This
# requires a Trusted Publishing policy on nuget.org naming this
# repository owner, this repository and the workflow file
# `release.yml` — see CONTRIBUTING.md.
# GHCR The automatic GITHUB_TOKEN authenticates, given packages: write.
#
# No repository secrets are required.

Expand Down Expand Up @@ -47,14 +52,15 @@ jobs:
echo "Publishing version $VERSION"

nuget:
name: Publish package to GitHub Packages
name: Publish package to nuget.org
needs: version
runs-on: ubuntu-latest

# What lets GITHUB_TOKEN push to the registry; without it the push is a 403.
# id-token lets the job mint the OIDC token that Trusted Publishing trades
# for a temporary API key. Without it NuGet/login has nothing to exchange.
permissions:
contents: read
packages: write
id-token: write

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -84,16 +90,25 @@ jobs:
name: nuget-package
path: ./artifacts/*

# GitHub Packages rejects a re-push of a version that already exists, so
# --skip-duplicate keeps a re-run of the workflow from failing the job.
#
# Symbol packages (.snupkg) are not supported by GitHub Packages; symbols
# travel inside the .nupkg instead, via the SourceLink settings in the csproj.
- name: Push to GitHub Packages
# Kept immediately before the push on purpose: the key it returns lasts an
# hour, and each OIDC token buys exactly one key, so requesting it early
# only risks it expiring behind a slow build.
- name: Exchange an OIDC token for a nuget.org API key
uses: NuGet/login@v1
id: login
with:
# The nuget.org profile name that owns the package. Public information,
# and the policy on nuget.org is what actually authorises the push.
user: aptacode

# --skip-duplicate so re-running the workflow on an already-published
# version reports success instead of failing the job. The .snupkg sitting
# alongside is pushed automatically.
- name: Push to nuget.org
run: >
dotnet nuget push "./artifacts/*.nupkg"
--api-key ${{ secrets.GITHUB_TOKEN }}
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
--api-key ${{ steps.login.outputs.NUGET_API_KEY }}
--source https://api.nuget.org/v3/index.json
--skip-duplicate

docker:
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@ separately here.

## [Unreleased]

Nothing yet.
### Changed

- **Publishing returned to [nuget.org](https://www.nuget.org/packages/Fortitude)**, using
Trusted Publishing rather than a stored API key: the release workflow exchanges a GitHub
OIDC token for a key that lasts an hour. Installing is plain `dotnet add package Fortitude`
again, with no feed to add and no token to create.
- Symbol packages are published again as `.snupkg`, which nuget.org's symbol server accepts;
they had been embedded in the assembly because GitHub Packages has no symbol server.
- The container image stays on `ghcr.io/timmoth/fortitude`.

## [10.2.0] - 2026-11-20

Expand Down Expand Up @@ -73,6 +81,8 @@ Nothing yet.
authenticating to the feed with a `read:packages` token even though the package is public;
the README has the one-time setup. Symbols are embedded in the assembly rather than shipped
as a `.snupkg`, which GitHub Packages does not support.
**Reverted in the next release** - publishing is back on nuget.org and needs no token. See
the Unreleased section above.
- **The package targets `net10.0` only.** It previously multi-targeted `net8.0` and `net9.0`
to reach the then-current LTS; both reached end of life in 2026. Breaking for consumers
still on those runtimes.
Expand Down
37 changes: 34 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,40 @@ cannot be merged. Dependabot opens grouped update pull requests weekly.
Releases are automated. Pushing a tag of the form `v10.2.0` publishes the package and the
multi-arch Docker image; the tag is the source of the version number.

Both artefacts go to GitHub: the package to GitHub Packages and the image to GHCR. Neither
needs a stored secret - the workflow's automatic `GITHUB_TOKEN` authenticates to both, given
the `packages: write` permission each job declares. **No repository secrets are required.**
The package goes to [nuget.org](https://www.nuget.org/packages/Fortitude) and the image to
GHCR. Neither uses a long-lived credential.

### nuget.org, via Trusted Publishing

The job mints a GitHub OIDC token, [`NuGet/login`](https://github.com/NuGet/login) exchanges
it for an API key valid for one hour, and that key does the push. There is no API key stored
anywhere.

It depends on a policy that lives on nuget.org, not in this repository. Under
**nuget.org -> your username -> Trusted Publishing**, the policy must name:

| Field | Value |
|---|---|
| Repository Owner | `Timmoth` |
| Repository | `Fortitude` |
| Workflow File | `release.yml` (the file name alone, no path) |
| Environment | leave empty - the workflow uses none |

The policy has to be owned by the account that owns the package, which is `aptacode`, and its
scope must allow publishing new versions of `Fortitude`.

The workflow names the publishing account (`aptacode`) inline. That is public information and
authorises nothing on its own - the policy on nuget.org is what does. **No repository secrets
are required.**

> A new policy on a private repository starts *temporarily active* for 7 days and turns
> permanent on the first successful publish. If no publish happens in that window it goes
> inactive, and the 7 days can be restarted from the same page.

### GHCR

The automatic `GITHUB_TOKEN` authenticates, given the `packages: write` permission the job
declares. Nothing to configure.

## Building a client for another language

Expand Down
10 changes: 5 additions & 5 deletions Fortitude.Client/Fortitude.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
<Title>Fortitude</Title>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<!--
Symbols are embedded in the assembly rather than shipped as a separate .snupkg:
GitHub Packages has no symbol server, so a side-car symbol package would have
nowhere to go. Combined with SourceLink below, a consumer can still step into
the source from a debugger.
A side-car symbol package, which nuget.org's symbol server accepts. Together with
the SourceLink settings below, a consumer can step straight into this source from
a debugger.
-->
<DebugType>embedded</DebugType>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageIcon>icon.png</PackageIcon>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
Expand Down
28 changes: 8 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ _Fortitude spins up a local mock server so you can fluently configure HTTP route

<p align="center">
<a href="https://github.com/Timmoth/Fortitude/actions/workflows/ci.yml"><img src="https://github.com/Timmoth/Fortitude/actions/workflows/ci.yml/badge.svg" alt="CI"/></a>
<a href="https://github.com/Timmoth/Fortitude/packages"><img src="https://img.shields.io/badge/package-GitHub%20Packages-2b3137?logo=github" alt="GitHub Packages"/></a>
<a href="https://www.nuget.org/packages/Fortitude"><img src="https://img.shields.io/nuget/v/Fortitude.svg" alt="NuGet"/></a>
<a href="https://www.nuget.org/packages/Fortitude"><img src="https://img.shields.io/nuget/dt/Fortitude.svg" alt="NuGet downloads"/></a>
<a href="https://github.com/Timmoth/Fortitude/pkgs/container/fortitude"><img src="https://img.shields.io/badge/image-ghcr.io-2b3137?logo=docker&logoColor=white" alt="Container image"/></a>
<a href="./LICENSE"><img src="https://img.shields.io/github/license/Timmoth/Fortitude.svg" alt="License"/></a>
</p>

[Package](https://github.com/Timmoth/Fortitude/packages) -
[NuGet](https://www.nuget.org/packages/Fortitude) -
[Container image](https://github.com/Timmoth/Fortitude/pkgs/container/fortitude)

## What is Fortitude?
Expand Down Expand Up @@ -45,9 +46,8 @@ Fortitude keeps expected behavior close to the test code, increases code coverag

### Running the Fortitude Server via Docker

The image moves to GHCR with the next release and is not published there yet — see
[installation](./docs/installation.md) for what to use until it is, and for running the
server without Docker.
The image is public, so this needs no login — see
[installation](./docs/installation.md) for running the server without Docker.

```bash
# Pull the latest Fortitude Server image:
Expand Down Expand Up @@ -100,26 +100,14 @@ dotnet test ./Examples/Fortitude.Example.Tests

**Make sure to add the NuGet package to your test project**

Fortitude is published to
[GitHub Packages](https://github.com/Timmoth?tab=packages&repo_name=Fortitude), not to
nuget.org, and GitHub Packages requires authentication even for public packages. Add the feed
once with a **classic** token carrying the `read:packages` scope:
[Fortitude on NuGet](https://www.nuget.org/packages/Fortitude)

```bash
dotnet nuget add source https://nuget.pkg.github.com/Timmoth/index.json \
--name fortitude \
--username <your-github-username> \
--password <classic-token-with-read:packages> \
--store-password-in-clear-text

# Install via the .NET CLI:
dotnet add package Fortitude
```

In CI the repository's own `GITHUB_TOKEN` works as the password.

**[installation](./docs/installation.md)** covers the committed `nuget.config` most teams
want instead, the click-through for Visual Studio, VS Code and Rider, and what each
authentication failure means.
[installation](./docs/installation.md) covers running the server, with or without Docker.

## Quick start

Expand Down
Loading
Loading