Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T349803, T369642, T352252, T368382: nx monorepo setup for versioning, and CHANGELOG generation #735

Merged
merged 202 commits into from
Sep 4, 2024

Conversation

lorenjohnson
Copy link
Contributor

@lorenjohnson lorenjohnson commented Jul 18, 2024

Remaining work:

  • Zoom-out and decide on our dev > release workflow including thinking through individual image releases (i.e. at what points to we publish releases, do we make it automatic from the start or phase into that, do we use Github Releases in addition to our CHANGELOGs, etc)
  • Introduce Actions way to manually kick-off a release for an individual product and restore Dockerhub push to work mostly as before
    - [ ] Update "Release checklist" / documentation accordingly
  • Merge, and make initial releases!

Includes work detailed in: #733.

Addresses partially or completely all of these Phab tickets:

Implementation summary:

Note: Initial work started in #731 and #733. These PRs can be re-opened, reviewed, and merged before this PR if it is helpful for review.

Uses nx / nx release for managing all the steps of release up until actually pushing things to Docker Hub, including:

  • Setting version (stored in package.json in each project)
  • Generating CHANGELOG.md entries in each project from commits between previous version and the current

There are several more things we can do here, including integrating this into Github Actions, but this is the starting place which gives us what we need to manually generate a consistent and correct version of a project (either an image or deploy) independently along with an automatically generated CHANGELOG.md entries.

While this uses the "non-Javascript" version of the nx installation to keep the noise down a bit, it does still require node and npm to be installed on the local dev machine. A Docker'ized version of this setup is probably possible, but may be adding a lot of extra friction (or not), TBD. For now I'm focused on getting the configuration correct.

Note: The names of the mixed-case build/* directories have been made all lowercase to match the name of the image that goes up on Dockerhub. Because of how git handles case changes you will need to rm -rf build within the root of the repository before you will be able to successfully check out this branch. The same in reverse...

Adoption:

  1. Try it out!: ./nx release --first-release --dry-run and look carefully at the log of the various things that would happen to understand how this all works.

  2. Versioning will rely on our tags. Recommended: Removing all your local git tags and re-pull the current set of tags from the Github remote:

git tag -d $(git tag -l)
git fetch
  1. Versions are automatically derived according to commits messages. To make sure this works correctly make commit messages using Conventional Commits prefixes (feat:, fix:, and chore:), and optionally but preferably with the product name scope (feat(wikibase):, etc). You could choose to forego this in development as we rely upon squash commits, but it is crucial that the squash commit message uses this format. Breaking Changes need to have "BREAKING CHANGE: ` in the commit footer message. Please read through and get familiar with Conventional Commits here: https://www.conventionalcommits.org/en/v1.0.0. *

  2. One engineer carefully make the first pre-release series using this sequence for each project, initially with --dry-run, but remove and go ahead and make the release once you're satisfied with the results:

./nx release version prerelease -p <project-name> --dry-run
./nx release changelog <version-returned-above> -p <project-name> --interactive --first-release --dry-run

For example, to see how the next pre-release of wikibase would be setup:

./nx release version prerelease -p wikibase --first-release --dry-run
./nx release changelog 3.0.1-0 -p wikibase --interactive --first-release --dry-run

@lorenjohnson lorenjohnson changed the base branch from main to docker-compose-building-tagging--extended July 18, 2024 13:21
@lorenjohnson lorenjohnson changed the title Nx monorepo non js nx monorepo setup for building, versioning, and CHANGELOG generation Jul 18, 2024
@lorenjohnson lorenjohnson requested a review from rti July 18, 2024 14:35
@lorenjohnson lorenjohnson changed the title nx monorepo setup for building, versioning, and CHANGELOG generation T352252, nx monorepo setup for versioning, and CHANGELOG generation Jul 18, 2024
@lorenjohnson lorenjohnson changed the title T352252, nx monorepo setup for versioning, and CHANGELOG generation T369642, T352252: nx monorepo setup for versioning, and CHANGELOG generation Jul 18, 2024
@lorenjohnson lorenjohnson changed the title T369642, T352252: nx monorepo setup for versioning, and CHANGELOG generation T349803, T369642, T352252: nx monorepo setup for versioning, and CHANGELOG generation Jul 18, 2024
@lorenjohnson lorenjohnson changed the title T349803, T369642, T352252: nx monorepo setup for versioning, and CHANGELOG generation T349803, T369642, T352252, T368382: nx monorepo setup for versioning, and CHANGELOG generation Jul 18, 2024
@lorenjohnson lorenjohnson force-pushed the nx-monorepo-non-js branch 2 times, most recently from 6f17df7 to 28a5fd8 Compare July 18, 2024 15:58
@lorenjohnson lorenjohnson force-pushed the nx-monorepo-non-js branch 3 times, most recently from 1b991cf to 62f3ae5 Compare August 18, 2024 15:11
README.md Show resolved Hide resolved
nx.json Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@rti rti self-requested a review September 3, 2024 15:24
Copy link
Contributor

@rti rti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoa! What a great piece of work. Thank you! Looking forward to play around with it as soon this is merged to main.

The last remaining question I have is about github releases (see above).

@lorenjohnson lorenjohnson merged commit 8946bc9 into main Sep 4, 2024
15 checks passed
@lorenjohnson lorenjohnson deleted the nx-monorepo-non-js branch September 4, 2024 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants