Releasing new components with GitHub Actions

Let's automate the release of new components.

Automation is our friend...if we know what it does! In this lesson, we'll take a moment to understand at a high level what the GitHub Actions scripts do. We'll also see how we can release our component library to NPM through GitHub.

An added benefit of this is that we can remove any NPM publishing credentials from individuals and only have them in CI, thus minimizing the risk of leaking sensitive keys and credentials.

Understanding our CI scripts#

You may have noticed that the component library has two CI scripts: main.yml and release.yml.

Our main script both builds code and sends an updated state to Chromatic, while the release script is exactly the same but also publishes to NPM if we pass the Chromatic step.