mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-16 09:36:44 +00:00
ci: Update release process to support major releases (no-changelog) (#6552)
This commit is contained in:
committed by
GitHub
parent
f89ef83c76
commit
5b5f30fd33
22
.github/scripts/update-changelog.mjs
vendored
22
.github/scripts/update-changelog.mjs
vendored
@@ -7,10 +7,13 @@ import { dirname } from 'path';
|
||||
import { fileURLToPath } from 'url';
|
||||
import stream from 'stream';
|
||||
import { promisify } from 'util';
|
||||
import packageJson from '../../package.json' assert { type: 'json' };
|
||||
|
||||
const pipeline = promisify(stream.pipeline);
|
||||
|
||||
const changelogFile = resolve(dirname(fileURLToPath(import.meta.url)), '../../CHANGELOG.md');
|
||||
const baseDir = resolve(dirname(fileURLToPath(import.meta.url)), '../..');
|
||||
const fullChangelogFile = resolve(baseDir, 'CHANGELOG.md');
|
||||
const versionChangelogFile = resolve(baseDir, `CHANGELOG-${packageJson.version}.md`);
|
||||
|
||||
const changelogStream = conventionalChangelog({
|
||||
preset: 'angular',
|
||||
@@ -24,13 +27,16 @@ const changelogStream = conventionalChangelog({
|
||||
process.exit(1);
|
||||
});
|
||||
|
||||
// We need to duplicate the stream here to pipe the changelog into two separate files
|
||||
const stream1 = new stream.PassThrough();
|
||||
const stream2 = new stream.PassThrough();
|
||||
changelogStream.pipe(stream1);
|
||||
changelogStream.pipe(stream2);
|
||||
|
||||
await pipeline(stream1, createWriteStream(versionChangelogFile));
|
||||
|
||||
// Since we can't read and write from the same file at the same time,
|
||||
// we use a temporary file to output the updated changelog to.
|
||||
const tmpFile = createTempFile();
|
||||
await pipeline(
|
||||
changelogStream,
|
||||
addStream(createReadStream(changelogFile)),
|
||||
createWriteStream(tmpFile),
|
||||
);
|
||||
|
||||
await pipeline(createReadStream(tmpFile), createWriteStream(changelogFile));
|
||||
await pipeline(stream2, addStream(createReadStream(fullChangelogFile)), createWriteStream(tmpFile)),
|
||||
await pipeline(createReadStream(tmpFile), createWriteStream(fullChangelogFile));
|
||||
|
||||
Reference in New Issue
Block a user