BBC-archive / psammead

React component library for BBC World Service and more
https://bbc.github.io/psammead/
Other
320 stars 54 forks source link

Find a better tool to manage versioning, changelogs and publishing #4333

Open jroebu14 opened 3 years ago

jroebu14 commented 3 years ago

Is your feature request related to a problem? Please describe. Managing dependencies in Psammead can be time and energy consuming. We built Talos and bumpPackages and bumpChangelogs scripts to manage versioning, changelogs and publishing in Psammead. Talos does its job but finding time to improve it is difficult given the team's now limited resources.

Describe the solution you'd like We'd like to investigate if there are other popular open-source solutions that could work in Psammead to manage this whole process. A streamlined versioning, changelogs and publishing process could free up a lot of our time.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Testing notes [Tester to complete]

Dev insight: Will there be any potential regression? etc

Additional context Add any other context or screenshots about the feature request here.

jroebu14 commented 3 years ago

The current Psammead changes/release process

  1. Make changes
  2. Commit changes
  3. Bump package version
  4. Open PR
  5. Update Changelog
  6. Get Approvals
  7. Merge changes then triggers release
  8. If package is an inter-dependency, Talos creates PRs bumping inter-dependant Psammead packages affected by release
  9. Manually approve and merge Talos PRs
  10. Repeat steps 8 and 9 until inter-dependencies are fully up-to-date

NB

Pros

Cons

What tools can we use to help?

Changesets

How it works

You open a Pull Request and include a changeset file (documentation of the changes and the desired semantic version bump e.g. major, minor, patch).

Merging the Pull Request does not trigger any release, instead a new Pull Request named Version Packages is created by the Changeset GitHub Action and includes the release plan. The release plan bumps the versions of all packages and dependent packages affected by the changeset files present in the repository, as well as the updated CHANGELOG.md files in each package.

Example changesets PR

When it’s time to trigger a release, you simply merge the Version Packages Pull Request. The Changesets GitHub Action takes care of doing the actual release, by publishing the packages to NPM, creating the git tags and the GitHub Release notes.

Pros

Cons

References

Repurposing Talos

Talos exists to upgrade our internal dependencies (i.e. Psammead dependencies) after we bump and release new Psammead packages. Why can't we just upgrade internal dependencies at the same time as bumping/releasing new packages? Because when CD runs, all dependencies, including our internal ones are pulled from the NPM registry meaning the build will fail because the new packages haven't been released yet and of course aren't in the NPM registry. This is what Talos does - it creates the PRs with the internal dependency upgrades when they are available.

Now that we are using Yarn Workspaces, when you install, all internal dependencies are linked locally, meaning they are not fetched from NPM and builds will not fail. This means we can release new packages and upgrade internal packages at the same time and Talos doesn't need to run at all.

Based on this, we can repurpose Talos into a tool we can run locally before making a PR - Something like this CLI (that I completed on a learning day) https://github.com/bbc/psammead/pull/4423.

Pros

Cons