In this post we’ll look at how to make sure Seed is deploying your Serverless services with your private GitHub npm modules.

GitHub Packages homepage

GitHub Packages are a great way to host private npm modules. And with a few easy steps you can integrate it with Seed.

  1. Get your GitHub access token, make sure to give it the read:packages scope.

  2. Add your access token as a secret

    Store it as a secret in Seed. For this example we’ll name it, GITHUB_ACCESS_TOKEN.

  3. Store your token in the build process and set the registry

    Add the following to your build spec (seed.yml).

     before_compile:
       - echo @OWNER:registry=https://npm.pkg.github.com >> ~/.npmrc
       - echo //npm.pkg.github.com/:_authToken=$GITHUB_ACCESS_TOKEN >> ~/.npmrc
    

    Where OWNER is your GitHub username or organization name.

A quick note on why we are setting the ~/.npmrc instead of the .npmrc. Most folks use serverless-webpack or serverless-bundle to package their Lambda functions. As a part of the package step, serverless-webpack does an extra npm install (in a temp directory). Currently it does not use the .npmrc in your project root. And so we need to set it in our user space explicitly.

You can read more about using private npm modules over on our docs.