Skip to content

Docs feedback: Write your title

I tried to create a merge request for the following improvement, but got an error when trying to commit changes at https://gitlab.com/gitlab-org/gitlab/-/update/master/doc/user/packages/rubygems_registry/index.md

https://docs.gitlab.com/ee/user/packages/rubygems_registry/

should use env variable $CI_API_V4_URL instead of https://gitlab.example.com/api/v4 for the GitLab CI related part. See https://docs.gitlab.com/ee/ci/variables/predefined_variables.html for a list of env variables.

The .gitlab-ci.yml would look like this:

# assuming a my_gem.gemspec file is present in the repository with the version currently set to 0.0.1
image: ruby

run:
  before_script:
    - mkdir ~/.gem
    - echo "---" > ~/.gem/credentials
    - |
      echo "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/rubygems: '${CI_JOB_TOKEN}'" >> ~/.gem/credentials
    - chmod 0600 ~/.gem/credentials # rubygems requires 0600 permissions on the credentials file
  script:
    - gem build my_gem
    - gem push my_gem-0.0.1.gem --host ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/rubygems