Skip to content

notify-downstream: Add NuGet indexing wait before dispatching to clet #181

@tig

Description

@tig

Problem

The notify-downstream job in .github/workflows/release.yml dispatches to gui-cs/clet immediately after dotnet nuget push, without waiting for NuGet to index the new package version. This causes clet's release workflow to fail with NU1102: Unable to find package Terminal.Gui.Editor with version (>= X.Y.Z) because dotnet restore hits the flat-container API before it's updated.

Example failure: gui-cs/clet#149 — clet v1.0.0-develop.63 failed because Terminal.Gui.Editor 2.2.2 wasn't indexed yet when the dispatched workflow ran.

How Terminal.Gui solves this

Terminal.Gui's notify-clet.yml has a "Wait for NuGet flat-container to index the version" step that polls for up to 10 minutes before dispatching:

for i in $(seq 1 60); do
  if curl -fsS https://api.nuget.org/v3-flatcontainer/terminal.gui/index.json \
     | jq -r '.versions[]' | grep -qx "$VER"; then
    echo "Indexed on flat-container: $VER (after $((i*10))s)"
    exit 0
  fi
  echo "Waiting for $VER on NuGet flat-container ($i/60, 10s each)..."
  sleep 10
done
echo "::error::Timed out after 10min waiting for $VER on flat-container"
exit 1

Proposed fix

Add an equivalent wait step in notify-downstream (or as a separate step before the dispatch) that polls https://api.nuget.org/v3-flatcontainer/terminal.gui.editor/index.json until the just-published version appears, with a 10-minute timeout.

- name: Wait for NuGet flat-container to index the version
  if: ${{ env.CLET_DISPATCH_TOKEN != '' }}
  run: |
    VER="${{ env.VERSION }}"
    for i in $(seq 1 60); do
      if curl -fsS https://api.nuget.org/v3-flatcontainer/terminal.gui.editor/index.json \
         | jq -r '.versions[]' | grep -qx "$VER"; then
        echo "Indexed on flat-container: $VER (after $((i*10))s)"
        exit 0
      fi
      echo "Waiting for $VER on NuGet flat-container ($i/60, 10s each)..."
      sleep 10
    done
    echo "::error::Timed out after 10min waiting for $VER on flat-container"
    exit 1

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions