Skip to content

Commit

Permalink
chore: fix gh-release script
Browse files Browse the repository at this point in the history
  • Loading branch information
rgwozdz committed Aug 24, 2023
1 parent e98936d commit 9290b6c
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions gh-release.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function execCommandLine(cmd, args) {
const bufferedListResult = await spawn(cmd, args);
return bufferedListResult.toString();
} catch (e) {
throw new Error(e.stderr.toString())
throw new Error(e.stderr.toString());
}
}

Expand All @@ -26,9 +26,13 @@ async function getChangelogEntry(tag) {
groups: { package },
} = TAG_REGEX.exec(tag);

const packageDir = package === 'koop-core' ? 'core' : package;

return new Promise((resolve, rejects) => {
// @TODO: make this safe for packages without an existing changelog.
const readStream = fs.createReadStream(`packages/${package}/CHANGELOG.md`);
const readStream = fs.createReadStream(
`packages/${packageDir}/CHANGELOG.md`,
);
const lineStream = byline(readStream);
let changelogLines = [];
let capture = false;
Expand All @@ -55,7 +59,15 @@ async function getChangelogEntry(tag) {
}

async function createRelease(tag, description) {
return execCommandLine('gh', ['release', 'create', tag, '--target', baseBranch, '--notes', description]);
return execCommandLine('gh', [
'release',
'create',
tag,
'--target',
baseBranch,
'--notes',
description,
]);
}

async function execute() {
Expand Down

0 comments on commit 9290b6c

Please sign in to comment.