I'm encountering an issue while trying to publish a Ruby gem to RubyGems.org using GitHub Actions. Although the workflow seems to execute without errors, I'm running into an issue when pushing the gem to RubyGems.
I'm using an API key generated from RubyGems, which I've added as a Secret in my GitHub repository. However, I'm encountering the following error in the GitHub Actions log:
Run gem push *.gem --key rubygems_api_key
ERROR: No such API key. Please add it to your configuration (done automatically on initial `gem push`).
Error: Process completed with exit code 1.
Here's how my workflow is configured in release.yml:
- name: Publish to RubyGems
run: gem push *.gem --key rubygems_api_key
env:
RUBYGEMS_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
I have verified that the API key is correctly added as a Secret in GitHub and that the Secret name matches in the workflow. Am I missing something, or is there an additional step I need to take? Any help would be greatly appreciated.
Thank you!