I’m using the standard template (https://github.com/actions/starter-workflows/blob/master/ci/gem-push.yml) for publishing a Ruby gem to the package registry. I commented out the part of publishing to RubyGems, since this gem is private for now. After successfully publishing the gem, I am unable to install it locally. The error I’m getting is a 401 after copying the install command from the packages page.
gem install my_gem --version "0.1.0" --source "https://rubygems.pkg.github.com/jer-k" ERROR: Could not find a valid gem 'my_gem' (= 0.1.0), here is why: Unable to download data from https://rubygems.pkg.github.com/jer-k/ - bad response Unauthorized 401 (https://rubygems.pkg.github.com/jer-k/specs.4.8.gz)
The repository ‘my_gem’ is a private repo I mantain.
The OWNER environment variable in the action is jer-k
The GPR_AUTH_TOKEN environment variable has package:write package:read repo permissions.
I added the same token to my .gem/credentials following the instructions from https://help.github.com/en/articles/configuring-rubygems-for-use-with-github-package-registry#authenticating-to-github-package-registry
I’m must be missing something about how to authenticate. I was also trying to search how to distinguish between publishing public and private packages (this is a feature the package registry talks about) but I couldn’t find anything to indicate how to do it; maybe that is based on whether or not the repository is private?