Skip to content

Commit 2d0bd77

Browse files
authored
chore(ci): release canary only on conventional commit (#1740)
1 parent 1397c9b commit 2d0bd77

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

scripts/release-canary.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
import { releaseVersion, releaseChangelog, releasePublish } from 'nx/release'
22
import { execSync } from 'child_process'
33
;(async () => {
4+
const { workspaceVersion: canaryCheckWorkspaceVersion } = await releaseVersion({
5+
verbose: true,
6+
gitCommit: false,
7+
stageChanges: false,
8+
dryRun: true, // Just to check if there are any conventional commits that warrant a release
9+
})
10+
11+
// If no version bump detected, exit early
12+
if (!canaryCheckWorkspaceVersion || canaryCheckWorkspaceVersion === '0.0.0') {
13+
console.log(
14+
'ℹ️ No conventional commits found that warrant a release. Skipping canary release.'
15+
)
16+
process.exit(0)
17+
}
18+
419
const { workspaceVersion, projectsVersionData } = await releaseVersion({
520
verbose: true,
621
gitCommit: false,
@@ -63,8 +78,5 @@ import { execSync } from 'child_process'
6378
console.log('⚠️ Continuing with release despite gotrue-js publish failure')
6479
}
6580

66-
execSync('git stash')
67-
console.log('✅ All changes stashed.')
68-
6981
process.exit(Object.values(publishResult).every((result) => result.code === 0) ? 0 : 1)
7082
})()

0 commit comments

Comments
 (0)