diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 604e86d..6524a7d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,7 +60,7 @@ jobs: cat semantic-release-output.log exit 1 fi - tagFormat=$(jq -r .tagFormat .releaserc) + tagFormat=$(node -e "const config=require('./release.config.cjs'); console.log(config.tagFormat)") if [ "${tagFormat}" = "null" ] then tagFormat="v\${version}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2210153..af3c468 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,8 @@ name: Release to GitHub Packages on: workflow_dispatch: + schedule: + - cron: "0 8 * * 3" jobs: quality_checks: diff --git a/.releaserc b/.releaserc deleted file mode 100644 index 46028f9..0000000 --- a/.releaserc +++ /dev/null @@ -1,80 +0,0 @@ -{ - "branches": [ - { - "name": "main" - } - ], - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "eslint", - "releaseRules": [ - { - "reminder": "Please update CONTRIBUTING.md if you change this", - "release": false - }, - { - "tag": "Fix", - "release": "patch" - }, - { - "tag": "Update", - "release": "patch" - }, - { - "tag": "New", - "release": "minor" - }, - { - "tag": "Breaking", - "release": "major" - }, - { - "tag": "Docs", - "release": "patch" - }, - { - "tag": "Build", - "release": false - }, - { - "tag": "Upgrade", - "release": "patch" - }, - { - "tag": "Chore", - "release": "patch" - } - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - "preset": "eslint" - } - ], - [ - "@semantic-release/changelog", - { - "changelogFile": "CHANGELOG.md" - } - ], - "@semantic-release/npm", - [ - "@semantic-release/github", - { - "assets": [ - { - "path": "CHANGELOG.md", - "label": "CHANGELOG.md" - } - ], - "successComment": false, - "failComment": false, - "failTitle": false - } - ] - ] -} diff --git a/release.config.cjs b/release.config.cjs new file mode 100644 index 0000000..d6678a1 --- /dev/null +++ b/release.config.cjs @@ -0,0 +1,87 @@ + +const {readFileSync} = require("fs") + +const commitTemplate = readFileSync("./releaseNotesTemplates/commit.hbs").toString() + +module.exports = { + branches: [ + { + name: "main" + } + ], + plugins: [ + [ + "@semantic-release/commit-analyzer", + { + preset: "eslint", + releaseRules: [ + { + reminder: "Please update CONTRIBUTING.md if you change this", + release: false + }, + { + tag: "Fix", + release: "patch" + }, + { + tag: "Update", + release: "patch" + }, + { + tag: "New", + release: "minor" + }, + { + tag: "Breaking", + release: "major" + }, + { + tag: "Docs", + release: "patch" + }, + { + tag: "Build", + release: false + }, + { + tag: "Upgrade", + release: "patch" + }, + { + tag: "Chore", + release: "patch" + } + ] + } + ], + [ + "@semantic-release/release-notes-generator", + { + preset: "eslint", + writerOpts: { + commitPartial: commitTemplate + } + } + ], + [ + "@semantic-release/changelog", + { + changelogFile: "CHANGELOG.md" + } + ], + [ + "@semantic-release/github", + { + assets: [ + { + path: "CHANGELOG.md", + label: "CHANGELOG.md" + } + ], + successComment: false, + failComment: false, + failTitle: false + } + ] + ] +} diff --git a/releaseNotesTemplates/commit.hbs b/releaseNotesTemplates/commit.hbs new file mode 100644 index 0000000..4f1607c --- /dev/null +++ b/releaseNotesTemplates/commit.hbs @@ -0,0 +1,3 @@ +* {{#if message}}{{message}}{{else}}{{header}}{{/if}} + +{{~!-- commit hash --}} {{#if @root.linkReferences}}([{{shortHash}}]({{#if @root.host}}{{@root.host}}/{{/if}}{{#if @root.owner}}{{@root.owner}}/{{/if}}{{@root.repository}}/{{@root.commit}}/{{hash}})){{else}}{{hash~}}{{/if}} diff --git a/sonar-project.properties b/sonar-project.properties index e613ade..a3f36c6 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -5,5 +5,6 @@ sonar.host.url=https://sonarcloud.io sonar.coverage.exclusions=\ **/*.test.*, \ **/jest.config.ts,scripts/*, \ - eslint.config.mjs + eslint.config.mjs, \ + release.config.cjs sonar.javascript.lcov.reportPaths=coverage/lcov.info