From f520fb31c60820e791753d3483f4af53dc6a5cc9 Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Mon, 9 Nov 2026 09:02:06 -0800 Subject: [PATCH 1/2] Bump version to 3.0.3 Co-Authored-By: Claude Opus 5.5 --- src/XTerm.NET/XTerm.NET.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/XTerm.NET/XTerm.NET.csproj b/src/XTerm.NET/XTerm.NET.csproj index f75721c..a959bd0 100644 --- a/src/XTerm.NET/XTerm.NET.csproj +++ b/src/XTerm.NET/XTerm.NET.csproj @@ -8,7 +8,7 @@ true - 3.0.2 + 3.0.3 3.0.2.0 Dotnet port of xterm.js, giving you ability to host console applications, with Sixel and Kitty graphics. Iciclecreek From 1ba5060f27a5cfccb44aee9b7af1a38500fe420c Mon Sep 17 00:00:00 2001 From: Tom Laird-McConnell Date: Mon, 9 Nov 2026 09:16:36 -0800 Subject: [PATCH 2/2] One PublishNuget workflow with a prerelease checkbox PublishNugetPrerelease.yml is folded into PublishNuget.yml as a "prerelease" input, so trusted publishing needs a single policy. Generated from PublishNugetWorkflow.csx. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/PublishNuget.yml | 69 ++++++++++++++-- .github/workflows/PublishNugetPrerelease.yml | 86 -------------------- 2 files changed, 60 insertions(+), 95 deletions(-) delete mode 100644 .github/workflows/PublishNugetPrerelease.yml diff --git a/.github/workflows/PublishNuget.yml b/.github/workflows/PublishNuget.yml index 1b59b03..20dc62c 100644 --- a/.github/workflows/PublishNuget.yml +++ b/.github/workflows/PublishNuget.yml @@ -2,6 +2,11 @@ name: Publish Nuget on: workflow_dispatch: + inputs: + prerelease: + description: 'Prerelease: publish -rcNNN instead of ' + type: boolean + default: false jobs: build: @@ -10,23 +15,70 @@ jobs: id-token: write # trusted publishing: OIDC token exchanged for a NuGet API key contents: read steps: - - name: Checkout + - name: Checkout uses: actions/checkout@v4 - + - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: 10.0.x - + - name: Restore dependencies run: dotnet restore src/XTerm.NET.slnx - name: Build - run: dotnet build src/XTerm.NET.slnx -c Release --no-restore - - - name: dotnet pack + run: dotnet build src/XTerm.NET.slnx -c Release --no-restore + + - name: Determine prerelease version + if: ${{ inputs.prerelease }} + id: versioning run: | - dotnet pack --no-build src/XTerm.NET.slnx -c Release -o packages --include-symbols --property WarningLevel=0 + set -euo pipefail + # Pack once into a throwaway folder so the packages themselves tell us + # which ids and versions ship -- guessing from a .csproj picks up + # demo and test projects that never pack. + dotnet pack src/XTerm.NET.slnx -c Release --no-build -o probe-packages --property WarningLevel=0 + mapfile -t NUPKGS < <(find probe-packages -maxdepth 1 -name '*.nupkg' ! -name '*.symbols.nupkg' | sort) + if [ ${#NUPKGS[@]} -eq 0 ]; then + echo "::error::dotnet pack produced no packages; nothing to publish." + exit 1 + fi + BASE_VERSION="" + NEXT_RC=1 + for NUPKG in "${NUPKGS[@]}"; do + NUSPEC=$(unzip -p "$NUPKG" '*.nuspec') + PKG_ID=$(echo "$NUSPEC" | grep -oPm1 '(?<=)[^<]+') + PKG_VERSION=$(echo "$NUSPEC" | grep -oPm1 '(?<=)[^<]+') + PKG_BASE=${PKG_VERSION%%-*} + echo "Discovered $PKG_ID $PKG_VERSION (base $PKG_BASE)" + if [ -z "$BASE_VERSION" ]; then + BASE_VERSION="$PKG_BASE" + elif [ "$BASE_VERSION" != "$PKG_BASE" ]; then + echo "::error::Packages disagree on base version ($BASE_VERSION vs $PKG_BASE); one prerelease version cannot cover them." + exit 1 + fi + PKG_LOWER=$(echo "$PKG_ID" | tr '[:upper:]' '[:lower:]') + VERSIONS=$(curl -sS "https://api.nuget.org/v3-flatcontainer/${PKG_LOWER}/index.json" | jq -r '.versions[]?' || echo "") + ESCAPED_VERSION=$(echo "$PKG_BASE" | sed 's/\./\\./g') + MAX_RC=$(echo "$VERSIONS" | grep -oP "^${ESCAPED_VERSION}-rc\K[0-9]+" | sort -n | tail -1 || true) + # Every package shares one version, so take the highest free rc across them all. + # 10# keeps the zero padding from being read as octal once we reach rc008. + if [ -n "$MAX_RC" ] && [ $((10#$MAX_RC + 1)) -gt "$NEXT_RC" ]; then + NEXT_RC=$((10#$MAX_RC + 1)) + fi + done + rm -rf probe-packages + PRERELEASE_VERSION="${BASE_VERSION}-rc$(printf '%03d' "$NEXT_RC")" + echo "version=$PRERELEASE_VERSION" >> $GITHUB_OUTPUT + echo "Prerelease version: $PRERELEASE_VERSION" + + - name: dotnet pack + if: ${{ !inputs.prerelease }} + run: dotnet pack --no-build src/XTerm.NET.slnx -c Release -o packages --include-symbols --property WarningLevel=0 + + - name: dotnet pack (prerelease) + if: ${{ inputs.prerelease }} + run: dotnet pack src/XTerm.NET.slnx -c Release -o packages --include-symbols --property WarningLevel=0 /p:Version=${{ steps.versioning.outputs.version }} - name: NuGet login (trusted publishing) id: nuget-login @@ -38,7 +90,6 @@ jobs: id: nuget-push uses: edumserrano/nuget-push@v1 with: - api-key: '${{ steps.nuget-login.outputs.NUGET_API_KEY }}' + api-key: '${{ steps.nuget-login.outputs.NUGET_API_KEY }}' working-directory: 'packages' fail-if-exists: false - diff --git a/.github/workflows/PublishNugetPrerelease.yml b/.github/workflows/PublishNugetPrerelease.yml deleted file mode 100644 index ee98e6c..0000000 --- a/.github/workflows/PublishNugetPrerelease.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: Publish Nuget Prerelease - -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - permissions: - id-token: write # trusted publishing: OIDC token exchanged for a NuGet API key - contents: read - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup .NET - uses: actions/setup-dotnet@v3 - with: - dotnet-version: 10.0.x - - - name: Determine prerelease version - id: versioning - run: | - # The package project, named rather than searched for. This was - # `find src -name "*.csproj" -not -name "*Test*" | head -1`, which returns whatever the - # directory walk reaches first -- Cat150.Fork today. That project carries no , - # so the lookup fell through to a hardcoded 1.0.0 and every prerelease went out as - # 1.0.0-rc001. The package id came from the same wrong file, so the query for existing - # release candidates asked about a package that does not exist and the counter never - # advanced either. This repo publishes one package and every other step already names the - # solution outright, so there was never anything to discover. - CSPROJ=src/XTerm.NET/XTerm.NET.csproj - - BASE_VERSION=$(grep -oPm1 '(?<=)[^<]+' "$CSPROJ" | sed 's/-.*//' || true) - if [ -z "$BASE_VERSION" ]; then - BASE_VERSION=$(grep -oPm1 '(?<=)[^<]+' "$CSPROJ" | sed 's/-.*//' || true) - fi - - # Fail rather than guess. A version pushed to nuget.org cannot be replaced or reused, so - # publishing under an invented number is the one outcome worse than a red build. - if [ -z "$BASE_VERSION" ]; then - echo "::error::No or found in $CSPROJ -- refusing to invent one." - exit 1 - fi - - PKG_ID=$(grep -oPm1 '(?<=)[^<]+' "$CSPROJ" || true) - if [ -z "$PKG_ID" ]; then - PKG_ID=$(basename "$CSPROJ" .csproj) - fi - PKG_LOWER=$(echo "$PKG_ID" | tr '[:upper:]' '[:lower:]') - VERSIONS=$(curl -sS "https://api.nuget.org/v3-flatcontainer/${PKG_LOWER}/index.json" | jq -r '.versions[]' 2>/dev/null || echo "") - ESCAPED_VERSION=$(echo "$BASE_VERSION" | sed 's/\./\\./g') - MAX_RC=$(echo "$VERSIONS" | grep -oP "^${ESCAPED_VERSION}-rc\K[0-9]+" | sort -n | tail -1) - if [ -z "$MAX_RC" ]; then - NEXT_RC=1 - else - NEXT_RC=$((MAX_RC + 1)) - fi - PRERELEASE_VERSION="${BASE_VERSION}-rc$(printf '%03d' $NEXT_RC)" - echo "version=$PRERELEASE_VERSION" >> $GITHUB_OUTPUT - echo "Prerelease version: $PRERELEASE_VERSION" - - - name: Restore dependencies - run: dotnet restore src/XTerm.NET.slnx - - - name: Build - run: dotnet build src/XTerm.NET.slnx -c Release --no-restore - - - name: dotnet pack - run: | - dotnet pack src/XTerm.NET.slnx -c Release -o packages --include-symbols --property WarningLevel=0 /p:Version=${{ steps.versioning.outputs.version }} - - - name: NuGet login (trusted publishing) - id: nuget-login - uses: NuGet/login@v1 - with: - user: thermous - - - name: Publish NuGet and symbols - id: nuget-push - uses: edumserrano/nuget-push@v1 - with: - api-key: '${{ steps.nuget-login.outputs.NUGET_API_KEY }}' - working-directory: 'packages' - fail-if-exists: false -