Use rake release with Github

October, 2021

Manual

gem push \
  --key github \
  --host https://rubygems.pkg.github.com/USERNAME/GEMNAME \
  GEMNAME-1.0.0.gem

With rake release

# Add credentials
echo ":github: Bearer ${GH_TOKEN}" >> ~/.gem/credentials

# Define key for gem release
bundle config set --global gem.push_key github

# Release gem
rake release

Also check the following:

That you have allowed_push_host setup in you .gemspec file

# eg. https://rubygems.pkg.github.com/EffectivaStudio
spec.metadata["allowed_push_host"] = "https://rubygems.pkg.github.com/<ORGANIZATION_NAME>"

That the name of the gem name and repository name matches

# Repository url
# https://github.com/EffectivaStudio/some-gem-name

spec.name = "some-gem-name"

Error explanation:

The expected resource was not found.
Your repository and you gem name are mismatched.
PROTIP: check - and _