From 0523588a8ae13829820f584e0e57224f333f60ad Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 7 Oct 2026 22:47:57 +0000 Subject: [PATCH] Publish only the versions RubyGems lacks The release workflow pushed both gems unconditionally, so a run for a version already on RubyGems failed on its refusal to overwrite. That is the normal case when a release is published by workflow_dispatch (from an environment that cannot push tags) and its tag is pushed afterwards to create the GitHub release: the tag's run would attach the gems and then go red. Each gem is now pushed only when RubyGems does not list its version, the check solid_agent's release workflow already makes. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0124DWuS48dmwj6duguc2wmh --- .github/workflows/release.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 067dc9c..43ee686 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -50,10 +50,26 @@ jobs: bundler-cache: true # The action publishes no v1 tag; @main is the ref its docs pin. - uses: rubygems/configure-rubygems-credentials@main + # Each gem is pushed only when RubyGems lacks its version, so a tag + # pushed after a workflow_dispatch already published the release (or + # a re-run) attaches the gems to the GitHub release and passes, + # instead of failing on RubyGems' refusal to overwrite a version. - name: Publish the core, then the adapter that depends on it run: | - gem build activeagents-telemetry.gemspec - gem push activeagents-telemetry-*.gem + publish() { + name="$1"; gemspec="$2" + gem build "$gemspec" + gem_path=$(ls "$name"-[0-9]*.gem) + version=$(basename "$gem_path" .gem | sed -E "s/^${name}-//") + # `gem list --all` prints one line: `name (1.2.0, 1.1.0, ...)`, + # so the version is matched between its delimiters. + if gem list --remote --exact --all "$name" | tr -d ' ' | + grep -qE "[(,]${version//./\\.}[,)]"; then + echo "$name $version is already on RubyGems; nothing to do." + else + gem push "$gem_path" + fi + } + publish activeagents-telemetry activeagents-telemetry.gemspec cd adapters/ruby_llm - gem build activeagents-telemetry-ruby_llm.gemspec - gem push activeagents-telemetry-ruby_llm-*.gem + publish activeagents-telemetry-ruby_llm activeagents-telemetry-ruby_llm.gemspec