Skip to content

Commit 2539671

Browse files
authored
chore: improve release script (#23)
1 parent d645ca9 commit 2539671

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

scripts/release.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ const release = async () => {
88
verbose: true,
99
});
1010

11+
const projectHasNewVersion = Object.entries(projectsVersionData).filter(
12+
([_, project]) => project.newVersion !== null
13+
);
14+
15+
if (projectHasNewVersion.length === 0) {
16+
console.log('No project release needed');
17+
process.exit(0);
18+
}
19+
1120
await releaseChangelog({
1221
versionData: projectsVersionData,
1322
version: workspaceVersion,
@@ -32,7 +41,7 @@ const release = async () => {
3241
// When a publish target fails, we want to fail the CI
3342
process.exit(1);
3443
}
35-
}
44+
};
3645

3746
const gitPush = async () => {
3847
const commandArgs = [
@@ -43,15 +52,17 @@ const gitPush = async () => {
4352
'--atomic',
4453
];
4554

46-
console.log("Pushing the current branch to the remote with the following command:")
55+
console.log(
56+
'Pushing the current branch to the remote with the following command:'
57+
);
4758
console.log(`git ${commandArgs.join(' ')}`);
4859

4960
try {
5061
await execCommand('git', commandArgs);
5162
} catch (err) {
5263
throw new Error(`Unexpected git push error: ${err}`);
5364
}
54-
}
65+
};
5566

5667
const execCommand = async (
5768
cmd: string,
@@ -90,7 +101,6 @@ const execCommand = async (
90101
}
91102
});
92103
});
93-
}
104+
};
94105

95106
release();
96-

0 commit comments

Comments
 (0)