From b8a225b6c7dc36b08854d45a4246b655b0b7ddfc Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Sun, 4 Sep 2022 16:16:21 -0300 Subject: [PATCH] docs: improve monorepo docs Signed-off-by: Carlos A Becker --- www/docs/customization/monorepo.md | 34 ++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/www/docs/customization/monorepo.md b/www/docs/customization/monorepo.md index 29c6f5c07dd..26516a691e5 100644 --- a/www/docs/customization/monorepo.md +++ b/www/docs/customization/monorepo.md @@ -5,12 +5,18 @@ If you want to use GoReleaser within a monorepo and use tag prefixes to mark "which tags belong to which sub project", GoReleaser has you covered. -## Premise +## Premises -You create your tags like `subproject1/v1.2.3` and `subproject2/v1.2.3`. +You project falls into either one of these categories: + +1. tags are like `subproject1/v1.2.3` and `subproject2/v1.2.3`; +1. tags are like `@user/thing@v1.2.3` (for a NPM package, for example) + and `v1.2.3` for the rest of the (Go) code. ## Usage +### Category 1 + You'll need to create a `.goreleaser.yaml` for each subproject you want to use GoReleaser in: ```yaml @@ -24,13 +30,13 @@ monorepo: Then, you can release with (from the project's root directory): -```sh +```bash goreleaser release --rm-dist -f ./subproj1/.goreleaser.yaml ``` Then, the following is different from a "regular" run: -- GoReleaser will then look if current commit has a tag prefixed with `subproject1`, and also the previous tag with the same prefix; +- GoReleaser will then look if current commit has a tag prefixed with `subproject1`, and the previous tag with the same prefix; - Changelog will include only commits that contain changes to files within the `subproj1` directory; - Release name gets prefixed with `{{ .ProjectName }} ` if empty; - All build's `dir` setting get set to `monorepo.dir` if empty; @@ -40,3 +46,23 @@ Then, the following is different from a "regular" run: The rest of the release process should work as usual. + +### Category 2 + +You'll need to create a `.goreleaser.yaml` for your Go code in the root of the +project: + +```yaml +# .goreleaser.yaml +monorepo: + tag_prefix: v +``` + +Then, you can release with: + +```bash +goreleaser release --rm-dist +``` + +GoReleaser will then ignore the tags that are not prefixed with `v`, and it +should work as expected from there on.