Automated Releases

Melos is able to automatically version, generate changelogs and publish to pub.dev automatically. It's also intelligent enough to detect any package dependencies which require a new version too.

Your Git project must be using Conventional Commits, a widely used specification for commit messages which are readable by humans and machines. Melos parses messages and detects exactly what sort of version upgrade is required.

Melos supports prefixes (like the Merge ... and Merged ... for example) before the conventional commit type, this is useful since some collaborative version control systems use these non-configurable prefixes when they merge pull requests.

Not using Conventional Commits?

If an existing Git project is already established and does not use Conventional Commits, it is still possible to adopt the convention and use Melos for future releases.

TODO how to adopt conventional commits with melos docs

Versioning

TODO docs on:

  • Scoping
  • Major/minor/patches
  • build versions
  • dependency versioning
  • bad commit messages?
  • manual versioning

Publishing

To publish packages on pub.dev you must:

  1. Have permission to publish all the packages.
  2. Be on a machine which is authenticated with Pub (read: not possible to publish via CIs).

Internally, Melos uses pub publish to publish the packages.

Once you have versioned your packages, run the publish command to check everything is good to go:

melos publish

By default, a dry-run is performed (nothing will be published).

Once satisfied with your pending releases, release them to pub.dev:

melos publish --no-dry-run

Git hosted packages

To use this feature enable it in melos.yaml

command:
  version:
    updateGitTagRefs: true # defaults to false

If your packages are private and don't publish to pub.dev, you can use the tag generated as git reference in your pubspec.yaml file and Melos will ensure the versions are updated accordingly.

Example:

dependencies:
  internal_dep:
    git:
      url: [email protected]:org/repo.git
      path: packages/internal_dep
      ref: internal_dep-v0.0.1

# will be updated to:

dependencies:
  internal_dep:
    git:
      url: [email protected]:org/repo.git
      path: packages/internal_dep
      ref: internal_dep-v0.0.2