Skip to content

Commit 5cb877e

Browse files
committed
fix: release mechanism with Lerna
1 parent f3497c9 commit 5cb877e

File tree

5 files changed

+30
-25
lines changed

5 files changed

+30
-25
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ jobs:
6161
name: LAME install on ${{ matrix.os }}
6262
runs-on: ${{ matrix.os }}
6363
needs: quality
64+
if: github.ref_name != 'master'
6465
strategy:
6566
fail-fast: false
6667
matrix:

.github/workflows/prepare-release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ jobs:
7272
SKIP_CHANGELOG: ${{ steps.changelog.outputs.skip }}
7373
run: |
7474
set -eo pipefail
75+
git checkout -B master ${{ github.event.workflow_run.head_commit.id }}
7576
pnpm run release:version > version.log 2>&1 || STATUS=$?
7677
cat version.log
7778
if [ -n "$STATUS" ]; then

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"@typescript-eslint/eslint-plugin": "~8.46.2",
8080
"@typescript-eslint/parser": "~8.46.2",
8181
"@vitest/coverage-istanbul": "~4.0.4",
82-
"conventional-changelog-cli": "^5.0.0",
82+
"conventional-changelog-cli": "~5.0.0",
8383
"conventional-changelog-conventionalcommits": "~9.1.0",
8484
"conventional-recommended-bump": "~11.2.0",
8585
"eslint": "~9.38.0",

pnpm-lock.yaml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/release-version.mjs

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,34 @@ const runCommand = (args) => {
2121
};
2222

2323
if (skipChangelog) {
24-
const [{ default: conventionalRecommendedBump }, semver] = await Promise.all(
25-
[
26-
import("conventional-recommended-bump"),
27-
import("semver"),
28-
],
29-
);
24+
const [semver] = await Promise.all([import("semver")]);
25+
26+
let releaseType = "patch";
3027

31-
const releaseType = await new Promise((resolve, reject) => {
32-
conventionalRecommendedBump(
33-
{ preset: "conventionalcommits" },
34-
(error, recommendation) => {
35-
if (error) {
36-
reject(error);
37-
return;
38-
}
28+
try {
29+
const module = await import("conventional-recommended-bump");
30+
const candidate =
31+
typeof module.default === "function"
32+
? module.default
33+
: undefined;
3934

40-
resolve(recommendation.releaseType ?? "patch");
41-
},
35+
if (candidate) {
36+
const recommendation = await candidate({
37+
preset: "conventionalcommits",
38+
});
39+
releaseType = recommendation?.releaseType ?? "patch";
40+
} else {
41+
console.warn(
42+
"[release] conventional-recommended-bump did not expose a callable default export. Defaulting to patch bump.",
43+
);
44+
}
45+
} catch (error) {
46+
console.warn(
47+
`[release] Failed to determine recommended bump (${error.message}). Defaulting to patch.`,
4248
);
43-
});
49+
}
4450

45-
const nextVersion = semver.inc(
46-
packageJson.version,
47-
releaseType ?? "patch",
48-
);
51+
const nextVersion = semver.inc(packageJson.version, releaseType);
4952
if (!nextVersion) {
5053
throw new Error("Unable to determine next version for release.");
5154
}
@@ -60,8 +63,8 @@ if (skipChangelog) {
6063
nextVersion,
6164
"--yes",
6265
"--no-commit-hooks",
63-
"--no-changelog",
64-
"--no-conventional-commits",
66+
"--conventional-commits",
67+
"--no-push",
6568
]);
6669
} else {
6770
console.log(

0 commit comments

Comments
 (0)