Desktop app 0.1.0 — Signs of AI Writing for Windows #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
| # Publish SignsOfAI.Core (library), SignsOfAI.Cli and SignsOfAI.Mcp (dotnet tools) to NuGet.org. | |
| # | |
| # No API key: this uses NuGet Trusted Publishing, which trades this workflow's OIDC token for a | |
| # short-lived key at run time. It requires a policy at nuget.org → Account → Trusted Publishing: | |
| # | |
| # Package Owner: peopleworksservices · Repository Owner: peopleworks | |
| # Repository: SignsofAI · Workflow File: nuget.yml | |
| # | |
| # To ship a version: bump <Version> in the three csproj files, merge, then publish a GitHub Release | |
| # tagged v<that version> (e.g. v0.1.0). Tests must pass before anything is pushed. | |
| name: Publish NuGet | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| id-token: write # required to obtain the OIDC token for trusted publishing | |
| jobs: | |
| publish: | |
| # A GitHub Release is also how the desktop app ships, tagged desktop-v<version>. Those releases | |
| # carry no NuGet packages, and without this the job would read the tag as a package version, | |
| # find nothing packed under that name and fail — a red X on a release that did nothing wrong. | |
| # Only v<version> tags mean "publish to NuGet". | |
| if: github.event_name == 'workflow_dispatch' || startsWith(github.ref_name, 'v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v6 | |
| with: | |
| dotnet-version: "10.0.x" | |
| # A broken build must never reach NuGet — published versions can't be deleted. | |
| # Name the solution explicitly: the repository now has two (the second one carries the | |
| # Windows-only desktop app), and left to discover one on its own dotnet stops with MSB1011. | |
| - name: Test | |
| run: dotnet test SignsOfAI.slnx -c Release --nologo | |
| - name: Pack | |
| run: | | |
| dotnet pack src/SignsOfAI.Core -c Release -o out | |
| dotnet pack src/SignsOfAI.Cli -c Release -o out | |
| dotnet pack src/SignsOfAI.Mcp -c Release -o out | |
| ls -1 out/ | |
| # Guards the classic footgun: tagging v0.2.0 while the csproj files still say 0.1.0. | |
| # --skip-duplicate would swallow that silently and report success. | |
| - name: Check the release tag matches what we built | |
| if: github.event_name == 'release' | |
| run: | | |
| want="${GITHUB_REF_NAME#v}" | |
| if ! ls out/*."$want".nupkg >/dev/null 2>&1; then | |
| echo "::error::Release is tagged $GITHUB_REF_NAME, but nothing packed as version $want." | |
| echo "Bump <Version> in the csproj files to $want, or retag the release." | |
| ls -1 out/ | |
| exit 1 | |
| fi | |
| # The MCP manifest carries its own version twice, and the MCP registry serves it to | |
| # clients. If it drifts, the registry advertises a version that doesn't exist. | |
| manifest="src/SignsOfAI.Mcp/.mcp/server.json" | |
| server_version=$(jq -r '.version' "$manifest") | |
| package_version=$(jq -r '.packages[0].version' "$manifest") | |
| if [ "$server_version" != "$want" ] || [ "$package_version" != "$want" ]; then | |
| echo "::error::$manifest says version=$server_version, packages[0].version=$package_version — expected $want." | |
| exit 1 | |
| fi | |
| echo "Tag $GITHUB_REF_NAME matches the packages and the MCP manifest." | |
| - name: NuGet login (trusted publishing) | |
| id: login | |
| uses: NuGet/login@v1 | |
| with: | |
| user: peopleworksservices | |
| - name: Push to NuGet | |
| run: | | |
| dotnet nuget push "out/*.nupkg" \ | |
| --api-key "${{ steps.login.outputs.NUGET_API_KEY }}" \ | |
| --source https://api.nuget.org/v3/index.json \ | |
| --skip-duplicate |