Skip to content

fix(rakefile): skip release:source_control_push on GitHub Actions#5

Merged
doris-xiao-bybit merged 2 commits into
mainfrom
fix/publish-rakefile-skip-git-push
Jul 22, 2026
Merged

fix(rakefile): skip release:source_control_push on GitHub Actions#5
doris-xiao-bybit merged 2 commits into
mainfrom
fix/publish-rakefile-skip-git-push

Conversation

@doris-xiao-bybit

Copy link
Copy Markdown
Collaborator

rubygems/release-gem@v1 hardcodes bundle exec rake release, and bundler/gem_tasks' release:source_control_push sub-task runs:

git push origin refs/heads/<current_branch>
git push origin refs/tags/v<version>

Both fail on tag-triggered CI:

  1. HEAD is detached (checked out at the tag SHA, not a branch), so refs/heads/HEAD does not match any — the push aborts before ever reaching release:rubygem_push (the OIDC gem-push step).
  2. The tag was already pushed by the developer before the workflow ran (that push IS the trigger). Re-pushing is redundant.

The workflow log confirms the sequence:

bybit-connector-ruby 0.1.1 built to pkg/bybit-connector-ruby-0.1.1.gem
Tagged v0.1.1.
Untagging v0.1.1 due to error.
rake aborted!
Running `git push origin refs/heads/HEAD` failed

Neutralize the sub-task on GitHub Actions only (guarded by $GITHUB_ACTIONS) so rake release proceeds straight to rubygem_push, which is the step that actually publishes via OIDC. Local bundle exec rake release behavior is unchanged for developers.

With this fix the full release chain on CI is:
release:guard_clean → verify clean tree (CI is always clean)
release:source_control_push → NO-OP on GH Actions (this PR)
release:rubygem_push → gem push, using GEM_HOST_API_KEY set by
rubygems/release-gem's OIDC exchange

doris-xiao-bybit and others added 2 commits July 22, 2026 19:12
`rubygems/release-gem@v1` hardcodes `bundle exec rake release`, and
bundler/gem_tasks' `release:source_control_push` sub-task runs:

    git push origin refs/heads/<current_branch>
    git push origin refs/tags/v<version>

Both fail on tag-triggered CI:

1. HEAD is detached (checked out at the tag SHA, not a branch), so
   `refs/heads/HEAD does not match any` — the push aborts before ever
   reaching `release:rubygem_push` (the OIDC gem-push step).
2. The tag was already pushed by the developer before the workflow ran
   (that push IS the trigger). Re-pushing is redundant.

The workflow log confirms the sequence:

    bybit-connector-ruby 0.1.1 built to pkg/bybit-connector-ruby-0.1.1.gem
    Tagged v0.1.1.
    Untagging v0.1.1 due to error.
    rake aborted!
    Running `git push origin refs/heads/HEAD` failed

Neutralize the sub-task on GitHub Actions only (guarded by
$GITHUB_ACTIONS) so rake release proceeds straight to rubygem_push,
which is the step that actually publishes via OIDC. Local
`bundle exec rake release` behavior is unchanged for developers.

With this fix the full release chain on CI is:
  release:guard_clean          → verify clean tree (CI is always clean)
  release:source_control_push  → NO-OP on GH Actions (this PR)
  release:rubygem_push         → gem push, using GEM_HOST_API_KEY set by
                                 rubygems/release-gem's OIDC exchange

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@doris-xiao-bybit
doris-xiao-bybit merged commit 64a413c into main Jul 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant