Skip to content

Commit

Permalink
ci(intellij): auto-bump intellij plugin version, and update readme an…
Browse files Browse the repository at this point in the history
…d changelog with HTML versions of corresponding markdown files
  • Loading branch information
chrissimon-au committed Mar 11, 2024
1 parent e214015 commit 549a992
Show file tree
Hide file tree
Showing 5 changed files with 6,842 additions and 5 deletions.
35 changes: 30 additions & 5 deletions src/.releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,24 @@
"changelogFile": "vscode/contextive/CHANGELOG.md",
"changelogTitle": "# Change Log"
}],
["./ci/semantic-release-markdown-to-html",{
"files": {
"changeLog": "vscode/contextive/CHANGELOG.md",
"intelliJReadme": "intellij/contextive/README.md"
},
"replacements": [{
"files": ["intellij/contextive/src/main/resources/META-INF/plugin.xml"],
"from": " <change-notes><!\\[CDATA\\[(\n|.)*\\]\\]><\\/change-notes>",
"to": " <change-notes><![CDATA[${htmlFiles.changeLog}]]></change-notes>",
"results": [{
"file": "intellij/contextive/src/main/resources/META-INF/plugin.xml",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
}],
"countMatches": true
}]
}],
["@google/semantic-release-replace-plugin",{
"replacements": [{
"files": ["language-server/Contextive.LanguageServer/Contextive.LanguageServer.fsproj"],
Expand All @@ -19,15 +37,22 @@
"numReplacements": 1
}],
"countMatches": true
},{
"files": ["intellij/contextive/build.gradle.kts"],
"from": "version = \".*\"",
"to": "version = \"${nextRelease.version}\"",
"results": [{
"file": "intellij/contextive/build.gradle.kts",
"hasChanged": true,
"numMatches": 1,
"numReplacements": 1
}],
"countMatches": true
}]
}],
["@semantic-release/npm",{
"npmPublish": false,
"pkgRoot": "vscode/contextive"
}],
["@semantic-release/git",{
"assets": ["language-server/Contextive.LanguageServer/Contextive.LanguageServer.fsproj", "vscode/contextive/CHANGELOG.md", "vscode/contextive/package.json", "vscode/contextive/package-lock.json", "vscode/contextive/npm-shrinkwrap.json"]
}],
"@semantic-release/github"
}]
]
}
18 changes: 18 additions & 0 deletions src/ci/semantic-release-markdown-to-html/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { prepare as replacePrepare } from '@google/semantic-release-replace-plugin';
import markDownIt from 'markdown-it';
import fsFull from 'fs';

const fs = fsFull.promises;
const md = markDownIt();

const prepare = async (pluginConfig, context) => {
context.htmlFiles = {};
for (var [key, markDownPath] of Object.entries(pluginConfig.files)) {
context.logger.log(`Generating HTML for ${key} from ${markDownPath}`);
const markdownContent = await fs.readFile(markDownPath, 'UTF-8');
context.htmlFiles[key] = md.render(markdownContent);
}
replacePrepare(pluginConfig, context);
}

export { prepare };
Loading

0 comments on commit 549a992

Please sign in to comment.