build: set up versioning with semantic-release

This commit is contained in:
2025-06-23 15:51:49 +03:00
parent e3c73af436
commit 74a1a9d664
7 changed files with 6813 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
node_modules

20
.releaserc.json Normal file
View File

@@ -0,0 +1,20 @@
{
"branches": [
"main"
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/changelog",
[
"@semantic-release/git",
{
"assets": [
"manifest.json",
"CHANGELOG.md"
],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}

0
CHANGELOG.md Normal file
View File

View File

@@ -1,7 +1,7 @@
{ {
"manifest_version": 3, "manifest_version": 3,
"name": "Goose Highlighter", "name": "Goose Highlighter",
"version": "1.1", "version": "1.1.1",
"description": "Highlight text on web pages", "description": "Highlight text on web pages",
"default_locale": "en", "default_locale": "en",
"permissions": [ "permissions": [

6767
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

10
package.json Normal file
View File

@@ -0,0 +1,10 @@
{
"devDependencies": {
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"semantic-release": "^24.2.5"
},
"scripts": {
"prepare": "node scripts/update-manifest-version.js"
}
}

View File

@@ -0,0 +1,14 @@
const fs = require("fs");
const path = "./manifest.json";
const version = process.env.npm_package_version;
if (!version) {
console.error("Version not found in npm_package_version.");
process.exit(1);
}
const manifest = JSON.parse(fs.readFileSync(path, "utf8"));
manifest.version = version;
fs.writeFileSync(path, JSON.stringify(manifest, null, 2));
console.log(`Updated manifest.json to version ${version}`);