dhoulb / multi-semantic-release

Proof of concept that wraps semantic-release to work with monorepos.
BSD Zero Clause License
203 stars 36 forks source link

How to initially realease? #96

Closed NullVoxPopuli closed 2 years ago

NullVoxPopuli commented 2 years ago

I just migrated from semantic-release-monorepo (can't release multiple things in one merge): and I have this log: https://github.com/NullVoxPopuli/ember-apply/runs/4908334008?check_suite_focus=true

copied here ``` $ multi-semantic-release --ignore-private-packages multi-semantic-release version: 2.11.0 semantic-release version: 17.4.7 flags: { "ignorePrivatePackages": true, "sequentialInit": false, "firstParent": false, "debug": false, "deps": { "bump": "override", "release": "patch" }, "dryRun": false } package paths [ '/home/runner/work/ember-apply/ember-apply/ember-apply/package.json', '/home/runner/work/ember-apply/ember-apply/packages/docs/package.json', '/home/runner/work/ember-apply/ember-apply/packages/ember/tailwind/package.json' ] [6:12:22 PM] › 🎉 Started multirelease! Loading 3 packages... [6:12:23 PM] › ⚠ [docs] is private, will be ignored [6:12:23 PM] › ✔ Loaded package ember-apply [6:12:23 PM] › ✔ Loaded package @ember-apply/tailwind [6:12:23 PM] › 🎉 Queued 2 packages! Starting release... [6:12:23 PM] [ember-apply] › ℹ Running semantic-release version 17.4.7 [6:12:23 PM] [@ember-apply/tailwind] › ℹ Running semantic-release version 17.4.7 [6:12:23 PM] [ember-apply] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [6:12:23 PM] [ember-apply] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [6:12:23 PM] [@ember-apply/tailwind] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [6:12:23 PM] [@ember-apply/tailwind] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [6:12:25 PM] [ember-apply] › ✔ Run automated release from branch main on repository https://x-access-token:[secure]@github.com/NullVoxPopuli/ember-apply [6:12:25 PM] [@ember-apply/tailwind] › ✔ Run automated release from branch main on repository https://x-access-token:[secure]@github.com/NullVoxPopuli/ember-apply [6:12:25 PM] [ember-apply] › ✔ Allowed to push to the Git repository [6:12:25 PM] [ember-apply] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [6:12:25 PM] [@ember-apply/tailwind] › ✔ Allowed to push to the Git repository [6:12:25 PM] [@ember-apply/tailwind] › ℹ Start step "verifyConditions" of plugin "Inline plugin" nullvoxpopuli [6:12:26 PM] [ember-apply] › ✔ Completed step "verifyConditions" of plugin "Inline plugin" [6:12:26 PM] [ember-apply] › ℹ No git tag version found on branch main [6:12:26 PM] [ember-apply] › ℹ No previous release found, retrieving all commits nullvoxpopuli [6:12:26 PM] [@ember-apply/tailwind] › ✔ Completed step "verifyConditions" of plugin "Inline plugin" [6:12:26 PM] [@ember-apply/tailwind] › ℹ No git tag version found on branch main [6:12:26 PM] [@ember-apply/tailwind] › ℹ No previous release found, retrieving all commits [6:12:26 PM] [ember-apply] › ℹ Found 134 commits since last release [6:12:26 PM] [ember-apply] › ℹ Start step "analyzeCommits" of plugin "Inline plugin" [6:12:26 PM] [@ember-apply/tailwind] › ℹ Found 134 commits since last release [6:12:26 PM] [@ember-apply/tailwind] › ℹ Start step "analyzeCommits" of plugin "Inline plugin" [6:12:26 PM] [ember-apply] › ✔ Completed step "analyzeCommits" of plugin "Inline plugin" [6:12:26 PM] [@ember-apply/tailwind] › ✔ Completed step "analyzeCommits" of plugin "Inline plugin" [6:12:26 PM] [ember-apply] › ℹ There are no relevant changes, so no new version is released. [6:12:26 PM] [@ember-apply/tailwind] › ℹ There are no relevant changes, so no new version is released. [6:12:26 PM] › 🎉 Released 0 of 2 packages, semantically! Done in 4.56s. ```

and idk what it says there are no relevant changes or why it doesn't think it needs to release since it's looking at all 134 commits of the repo.

How do I make it release?

NullVoxPopuli commented 2 years ago

I re-published the latest tags with the format that multi-semantic-release expects:

log here ``` Run yarn publish:release yarn run v1.22.17 $ multi-semantic-release --ignore-private-packages multi-semantic-release version: 2.11.0 semantic-release version: 17.4.7 flags: { "ignorePrivatePackages": true, "sequentialInit": false, "firstParent": false, "debug": false, "deps": { "bump": "override", "release": "patch" }, "dryRun": false } package paths [ '/home/runner/work/ember-apply/ember-apply/ember-apply/package.json', '/home/runner/work/ember-apply/ember-apply/packages/docs/package.json', '/home/runner/work/ember-apply/ember-apply/packages/ember/tailwind/package.json' ] [6:23:44 PM] › 🎉 Started multirelease! Loading 3 packages... [6:23:45 PM] › ⚠ [docs] is private, will be ignored [6:23:45 PM] › ✔ Loaded package ember-apply [6:23:45 PM] › ✔ Loaded package @ember-apply/tailwind [6:23:45 PM] › 🎉 Queued 2 packages! Starting release... [6:23:45 PM] [ember-apply] › ℹ Running semantic-release version 17.4.7 [6:23:45 PM] [@ember-apply/tailwind] › ℹ Running semantic-release version 17.4.7 [6:23:45 PM] [ember-apply] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [6:23:45 PM] [ember-apply] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [6:23:45 PM] [@ember-apply/tailwind] › ✔ Loaded plugin "addChannel" from "@semantic-release/npm" [6:23:45 PM] [@ember-apply/tailwind] › ✔ Loaded plugin "addChannel" from "@semantic-release/github" [6:23:47 PM] [ember-apply] › ✔ Run automated release from branch main on repository https://x-access-token:[secure]@github.com/NullVoxPopuli/ember-apply [6:23:47 PM] [@ember-apply/tailwind] › ✔ Run automated release from branch main on repository https://x-access-token:[secure]@github.com/NullVoxPopuli/ember-apply [6:23:47 PM] [ember-apply] › ✔ Allowed to push to the Git repository [6:23:47 PM] [ember-apply] › ℹ Start step "verifyConditions" of plugin "Inline plugin" [6:23:47 PM] [@ember-apply/tailwind] › ✔ Allowed to push to the Git repository [6:23:47 PM] [@ember-apply/tailwind] › ℹ Start step "verifyConditions" of plugin "Inline plugin" nullvoxpopuli [6:23:48 PM] [ember-apply] › ✔ Completed step "verifyConditions" of plugin "Inline plugin" nullvoxpopuli [6:23:48 PM] [@ember-apply/tailwind] › ✔ Completed step "verifyConditions" of plugin "Inline plugin" [6:23:48 PM] [ember-apply] › ℹ Found git tag ember-apply@1.4.2 associated with version 1.4.2 on branch main [6:23:48 PM] [ember-apply] › ℹ Found 25 commits since last release [6:23:48 PM] [ember-apply] › ℹ Start step "analyzeCommits" of plugin "Inline plugin" [6:23:48 PM] [@ember-apply/tailwind] › ℹ Found git tag @ember-apply/tailwind@2.0.0 associated with version 2.0.0 on branch main [6:23:48 PM] [@ember-apply/tailwind] › ℹ Found 24 commits since last release [6:23:48 PM] [@ember-apply/tailwind] › ℹ Start step "analyzeCommits" of plugin "Inline plugin" [6:23:48 PM] [ember-apply] › ✔ Completed step "analyzeCommits" of plugin "Inline plugin" [6:23:48 PM] [@ember-apply/tailwind] › ✔ Completed step "analyzeCommits" of plugin "Inline plugin" [6:23:48 PM] [ember-apply] › ℹ There are no relevant changes, so no new version is released. [6:23:48 PM] [@ember-apply/tailwind] › ℹ There are no relevant changes, so no new version is released. [6:23:48 PM] › 🎉 Released 0 of 2 packages, semantically! Done in 4.26s. ```

It`s still claiming:

[6:23:48 PM] [ember-apply] › ℹ  There are no relevant changes, so no new version is released.
[6:23:48 PM] [@ember-apply/tailwind] › ℹ  There are no relevant changes, so no new version is released.
NullVoxPopuli commented 2 years ago

Running the --debug --dry-run locally reveals that commits that should cause a release are detected: image

NullVoxPopuli commented 2 years ago

not sure what this means:

 msr:synchronizer ready: _analyzed +2s
  msr:synchronizer ready: _analyzed +0ms
  msr:synchronizer ready: _depCheck0 +1ms
  msr:synchronizer ready: _depCheck0 +0ms
  msr:inlinePlugin commits analyzed: ember-apply +99ms
  msr:inlinePlugin release type: undefined +0ms
  msr:inlinePlugin commits analyzed: @ember-apply/tailwind +0ms
  msr:inlinePlugin release type: undefined +0ms

release type is undefined -- how did that happen?

esatterwhite commented 2 years ago

The no relevant changes usually means there were no commits that matched your release rules. So there is nothing to do

NullVoxPopuli commented 2 years ago

How do I debug that though? I have lots of commits that need releasing 🤔

antongolub commented 2 years ago

Hmmm... Does semantic-release/commit-analyzer recognize this prefix fix(html, transform):?

> var p = require('conventional-commits-parser').sync; p('feat(foo): test')
{
  type: 'feat',
  scope: 'foo',
  subject: 'test',
  merge: null,
  header: 'feat(foo): test',
  body: null,
  footer: null,
  notes: [],
  references: [],
  mentions: [],
  revert: null
}
> var p = require('conventional-commits-parser').sync; p('feat(foo, bar): test')
{
  type: null,
  scope: null,
  subject: null,
  merge: null,
  header: 'feat(foo, bar): test',
  body: null,
  footer: null,
  notes: [],
  references: [],
  mentions: [],
  revert: null
}
> 
antongolub commented 2 years ago

This syntax doesnt seem to follow the conventional commits spec:

A scope MAY be provided after a type. A scope MUST consist of a noun describing a section of the codebase surrounded by parenthesis, e.g., fix(parser):

NullVoxPopuli commented 2 years ago

my coventional commits commit linter doesn't complain about it 🤔 But maybe these aren't the same thing, and that's why I have an issue?


❯ cat commitlint.config.js 
'use strict';

module.exports = {
  extends: ['@commitlint/config-conventional'],
  // https://commitlint.js.org/#/reference-rules
  // Level [0..2]: 0 disables the rule. For 1 it will be considered a warning for 2 an error.
  // Applicable always|never: never inverts the rule.
  // Value: value to use for this rule.
  rules: {
    // 72, the default, is a little short
    'header-max-length': [1, 'always', 100],
    // Let people use caps
    'header-case': [0],
    // Let people write  sentences
    'header-full-stop': [0],
    'subject-case': [0],
  },
};
antongolub commented 2 years ago

¯_(ツ)_/¯ semrel uses conventional-commits-parser and conventional-commits-filter, so if all of your commits have the same prefix it probably prevents the release from working:

const {isUndefined} = require('lodash');
const parser = require('conventional-commits-parser').sync;
const filter = require('conventional-commits-filter');
...

UPD The reason is something else: semrel replaces conventional-commits-parser default pattern (headerPattern: /^(\w*)(?:\(([\w$.\-*/ ]*)\))?: (.*)$/,) with conventional-changelog-angulars headerPattern: /^(\w*)(?:\((.*)\))?: (.*)$/,

esatterwhite commented 2 years ago

I think it depends on the preset. You can also specify you own release rules

https://github.com/logdna/semantic-release-config-logdna/blob/main/index.js#L30

antongolub commented 2 years ago

@NullVoxPopuli,

I've added an additional debug point (v2.11.1). Could repeat your flow with the same opts?

NullVoxPopuli commented 2 years ago

How do I know if, on a PR, I'll trigger a release?

atm, I see this output:

[8:42:42 AM] [ember-apply] › ℹ  This test run was triggered on the branch change-release-config-again, while semantic-release is configured to only publish from main, therefore a new version won’t be published.
[8:42:42 AM] [@ember-apply/embroider] › ℹ  This test run was triggered on the branch change-release-config-again, while semantic-release is configured to only publish from main, therefore a new version won’t be published.
[8:42:42 AM] [@ember-apply/tailwind] › ℹ  This test run was triggered on the branch change-release-config-again, while semantic-release is configured to only publish from main, therefore a new version won’t be published.
[8:42:42 AM] › 🎉  Released 0 of 3 packages, semantically!
Done in 3.33s.

There is no indication if releasing would happen if I were on main, ya know?

antongolub commented 2 years ago

I'm afraid semrel is not intended for PR branches. We need debug output as you published above

 msr:synchronizer ready: _analyzed +2s
  msr:synchronizer ready: _analyzed +0ms
  msr:synchronizer ready: _depCheck0 +1ms
  msr:synchronizer ready: _depCheck0 +0ms
  msr:inlinePlugin commits analyzed: ember-apply +99ms
....
NullVoxPopuli commented 2 years ago

I tried to do something sneaky in C.I., here: https://github.com/NullVoxPopuli/ember-apply/runs/5275131759?check_suite_focus=true#step:6:14

But:

[1:51:51 PM] [@ember-apply/embroider] › ℹ  This run was triggered by a pull request and therefore a new version won't be published.

how does it know?! lol

gonna edit node_modules for extra logging.

does --debug do anything? 🤔

antongolub commented 2 years ago

You may trigger release locally with --dry-run and --debug flags.

NullVoxPopuli commented 2 years ago

right, but I'm just saying that the output doesn't give me enough information (and I'm trying to re-figure out what that information I need is, because I didn't keep track of my changes when I added the logs 😅 )

antongolub commented 2 years ago

DEBUG=* <cmd> can also enable debug afair

esatterwhite commented 2 years ago

You can debug everything. It's all using the debug package, so just set an environment variable.

DEBUG=* npm run semantic-release
esatterwhite commented 2 years ago

DEBUG=* <cmd> also can enable debug afair

Jinx

NullVoxPopuli commented 2 years ago

This commit did some releasing: https://github.com/NullVoxPopuli/ember-apply/actions/runs/1876616129

(with a very simple commit message)

So, I guess I'll close this issue and open a new one if I run in to issues again (but it may be that I need to tweak the commit analyzer -- I've been wanting to do this anyway, cause long-form commit messages don't make it into the changelog)

Thanks, all!