Continuous deployments with Changesets + GitHub actions

Jake Ginnivan
2 min readJun 7, 2021
Photo by Chris Pagan on Unsplash

Changesets is an awesome tool for versioning NPM packages and maintaining changelogs for projects, it is quickly becoming a part of all our projects, public and private alike.

The Changesets GitHub action is designed to open a pull request with a running changelog then that PR is merged to do the release. This is great when you want to control when you release to NPM, but we want to simply release to NPM as soon as a pull request with a changeset is merged.


1. Create a personal access token

GitHub actions have the GITHUB_TOKEN secret, but that token will not trigger actions when it’s used.

We have a service account we have created which we generate personal access token (PAT) for and can use when we need to work with GitHub and trigger actions.

Once you have created a PAT save it as a GitHub secret for that repo, ours is called SERVICE_ACCOUNT_PAT

2. Create main workflow

The main workflow has 2 jobs

  1. version
  2. build

version will check if there are any unreleased packages, if there is it will version them and push to master, triggering a new build

build will only run if the version job had no unreleased changes

The below gist has been annotated with the various parts

This setup minimises the changes of git conflicts as the workflow which versions will run quickly and push the new commit as soon as possible.

3. That’s it

Your NPM packages will now release as soon as something is merged to master with a changeset.




Jake Ginnivan

Co-Founder | Principal Consultant | Previously Tech Lead Seven West Media WA | International Speaker | OSS | Mentor