Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
* Semantic Release Config
*/

const fs = require('fs').promises;
const path = require('path');
const { readFile } = require('fs').promises;
const { resolve } = require('path');

// Get env vars
const ref = process.env.GITHUB_REF;
Expand All @@ -24,12 +24,14 @@
async function config() {

// Get branch
const branch = ref.split('/').pop();
const branch = ref?.split('/')?.pop() || '(current branch could not be determined)';
// eslint-disable-next-line no-console
console.log(`Running on branch: ${branch}`);

// Set changelog file
//const changelogFile = `./changelogs/CHANGELOG_${branch}.md`;
const changelogFile = `./CHANGELOG.md`;
// eslint-disable-next-line no-console
console.log(`Changelog file output to: ${changelogFile}`);

// Load template file contents
Expand Down Expand Up @@ -59,13 +61,13 @@
{ scope: 'no-release', release: false },
],
parserOpts: {
noteKeywords: [ 'BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING' ],
noteKeywords: ['BREAKING CHANGE'],
},
}],
['@semantic-release/release-notes-generator', {
preset: 'angular',
parserOpts: {
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES', 'BREAKING']
noteKeywords: ['BREAKING CHANGE']
},
writerOpts: {
commitsSort: ['subject', 'scope'],
Expand All @@ -87,7 +89,7 @@
['@semantic-release/github', {
successComment: getReleaseComment(),
labels: ['type:ci'],
releasedLabels: ['state:released<%= nextRelease.channel ? `-${nextRelease.channel}` : "" %>']
releasedLabels: ['state:released<%= nextRelease.channel ? `-\${nextRelease.channel}` : "" %>']

Check failure on line 92 in release.config.js

View workflow job for this annotation

GitHub Actions / Node.js 22

Unnecessary escape character: \$

Check failure on line 92 in release.config.js

View workflow job for this annotation

GitHub Actions / Node.js 20

Unnecessary escape character: \$

Check failure on line 92 in release.config.js

View workflow job for this annotation

GitHub Actions / Node.js 18

Unnecessary escape character: \$

Check failure on line 92 in release.config.js

View workflow job for this annotation

GitHub Actions / Node.js 24

Unnecessary escape character: \$
}],
],
};
Expand All @@ -97,15 +99,12 @@

async function loadTemplates() {
for (const template of Object.keys(templates)) {
const text = await readFile(path.resolve(__dirname, resourcePath, templates[template].file));
const filePath = resolve(__dirname, resourcePath, templates[template].file);
const text = await readFile(filePath, 'utf-8');
templates[template].text = text;
}
}

async function readFile(filePath) {
return await fs.readFile(filePath, 'utf-8');
}

function getReleaseComment() {
const url = repositoryUrl + '/releases/tag/${nextRelease.gitTag}';
const comment = '🎉 This change has been released in version [${nextRelease.version}](' + url + ')';
Expand Down
Loading