From 9f4cd6f2d952a1c3ff018801cbe0199607293c1d Mon Sep 17 00:00:00 2001 From: Anush Date: Thu, 25 May 2023 06:12:34 +0530 Subject: [PATCH] feat: manifest version value bump (#13) * feat: manifest.json version bump * docs: manifest.json version bump info README.md --- README.md | 6 ++++++ release.config.js | 23 ++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f216bc3..d218fe2 100644 --- a/README.md +++ b/README.md @@ -178,6 +178,12 @@ Unless you have an `action.yml` present in your root folder, this module is not If you have an `action.yml` present, our config will attempt to adjust the container version to the newly pushed `npm` and `docker` tags. +### Manifest.json + +Unless you have a `manifest.json` present in your root folder, this module is not added to the release config. + +If you have a `manifest.json` present, our config will attempt to adjust the `version` value to the newly pushed `npm` and `docker` tags. + ### Docker Unless you have a `Dockerfile` present in your root folder, this module is not added to the release config. diff --git a/release.config.js b/release.config.js index 7d72828..8f293b7 100644 --- a/release.config.js +++ b/release.config.js @@ -140,6 +140,26 @@ if (actionExists) { }); } +const manifestExists = existsSync("./manifest.json"); +if (manifestExists) { + addPlugin("@google/semantic-release-replace-plugin", { + "replacements": [{ + "files": [ + "manifest.json" + ], + "from": `"version": ".*"`, + "to": `"version": "\${nextRelease.version}"`, + "results": [{ + "file": "manifest.json", + "hasChanged": true, + "numMatches": 1, + "numReplacements": 1 + }], + "countMatches": true + }] + }); +} + addPlugin("@semantic-release/git", { "assets": [ "LICENSE*", @@ -151,7 +171,8 @@ addPlugin("@semantic-release/git", { "pnpm-lock.yaml", "public/**/*", "supabase/**/*", - "action.yml" + "action.yml", + "manifest.json" ], "message": `chore(<%= nextRelease.type %>): release <%= nextRelease.version %> <%= nextRelease.channel !== null ? \`on \${nextRelease.channel} channel \` : '' %>[skip ci]\n\n<%= nextRelease.notes %>` });