Using private packages / dependencies

How to use Github packages for private dependencies

Accessing GitHub packages for private dependencies requires the following steps:

  1. Create a personal access token in GitHub

  2. Open your Codemagic app settings, and go to the Environment variables tab.

  3. Enter the desired Variable name, e.g. GITHUB_TOKEN.

  4. Copy and paste the token as Variable value.

  5. Enter the variable group name, e.g. github_credentials. Click the button to create the group.

  6. Make sure the Secure option is selected.

  7. Click the Add button to add the variable.

  8. Add the variable group to your codemagic.yaml file

      environment:
        groups:
          - github_credentials

  9. Create a .npmrc file with the following contents (where @owner is your github username):

      registry=https://registry.npmjs.org/
      @owner:registry=https://npm.pkg.github.com/
      //npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}