Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,29 @@ RSpec::Core::RakeTask.new(:spec)
RuboCop::RakeTask.new

task default: %i[rubocop spec]

# ── CI release fix ────────────────────────────────────────────────────────────
# `bundle exec rake release` (invoked by rubygems/release-gem@v1) runs
# `release:source_control_push` which does:
# git push origin refs/heads/<current_branch>
# git push origin refs/tags/v<version>
# On tag-triggered CI:
# 1. HEAD is detached (checked out at the tag SHA, not a branch), so
# `refs/heads/HEAD` doesn't exist → `error: src refspec refs/heads/HEAD
# does not match any` and rake aborts.
# 2. The tag was already pushed by the developer — that's what triggered
# the workflow. Re-pushing it is redundant.
#
# Neutralize the sub-task on GitHub Actions so rake release proceeds to
# `release:rubygem_push`, which is the step that actually publishes to
# rubygems.org via OIDC. Local `bundle exec rake release` behavior is
# unchanged.
if ENV['GITHUB_ACTIONS'] == 'true'
Rake::Task['release:source_control_push'].clear if Rake::Task.task_defined?('release:source_control_push')
namespace :release do
task :source_control_push do
puts '[release:source_control_push] SKIP on GitHub Actions ' \
'(HEAD detached at tag; tag already pushed by developer).'
end
end
end
Loading