pmowrer / semantic-release-monorepo

Apply semantic-release's automatic publishing to a monorepo.
MIT License
522 stars 80 forks source link

Dependent package #154

Open Tomerfi1210 opened 8 months ago

Tomerfi1210 commented 8 months ago

Hey, I have a monorepo project with this tree:

app/
 --common
   |--package.json
 --app1
   |--package.json
 --app2
   |--package.json

For now, when I there is a change in app1 or app2, a new tag and release is happend. But, I want also to trigger new tag and release when there is a change in common directory.

Im using gitlab, npm and lerna for that.

Example of package.json in app1:

{
  "name": "app1",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "semantic-release": "lerna exec --concurrency 1 -- semantic-release -e semantic-release-monorepo --tag-format='${LERNA_PACKAGE_NAME}-v\\${version}'"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@semantic-release/changelog": "github:semantic-release/changelog",
    "@semantic-release/commit-analyzer": "github:semantic-release/commit-analyzer",
    "@semantic-release/git": "github:semantic-release/git",
    "@semantic-release/release-notes-generator": "github:semantic-release/release-notes-generator",
    "@semantic-release/npm": "github:semantic-release/npm",
    "conventional-changelog-conventionalcommits": "^7.0.2",
    "semantic-release-monorepo": "^8.0.2"
  },
  "release": {
    "monorepo": {
      "dependencies": [
        "common"
      ]
    },
    "branches": [
      "dev",
      "master"
    ],
    "plugins": [
      "@semantic-release/changelog",
      [
        "@semantic-release/commit-analyzer",
        {
          "preset": "conventionalcommits",
          "presetConfig": {
            "types": [
              {
                "type": "feat",
                "section": "Features"
              },
              {
                "type": "fix",
                "section": "Bug Fixes"
              },
              {
                "type": "chore",
                "hidden": true
              },
              {
                "type": "docs",
                "hidden": true
              },
              {
                "type": "style",
                "hidden": true
              },
              {
                "type": "refactor",
                "hidden": true
              },
              {
                "type": "perf",
                "hidden": true
              },
              {
                "type": "test",
                "hidden": true
              }
            ],
            "issueUrlFormat": ""
          }
        }
      ],
      "@semantic-release/release-notes-generator",
      [
        "@semantic-release/gitlab",
        {
          "gitlabUrl": ""
        }
      ]
    ],
    "repositoryUrl": ""
  }
}

Thank you !

coreyar commented 2 weeks ago

My first thought would be to break out your releases into multiple stages.

You'll want to consider the range of versions you want app1 and app2 to automatically accept from common i.e. non breaking changes. To avoid automatic breaking releases of app1 and app2