ci(release): don't patch MSR anymore, add npm semantic release plugin

This commit is contained in:
PalmDevs
2024-07-22 22:40:56 +07:00
parent 3ad0f7b19d
commit b76e223f07
6 changed files with 36 additions and 29 deletions

View File

@@ -1,4 +1,6 @@
export default {
import defineSubprojectReleaseConfig from '../../semantic-release-config.js'
export default defineSubprojectReleaseConfig({
plugins:
process.env.RELEASE_WORKFLOW_STEP === 'publish'
? [
@@ -27,4 +29,4 @@ export default {
},
],
],
}
})

View File

@@ -1,4 +1,6 @@
export default {
import defineSubprojectReleaseConfig from '../../semantic-release-config.js'
export default defineSubprojectReleaseConfig({
plugins:
process.env.RELEASE_WORKFLOW_STEP === 'publish'
? [
@@ -27,4 +29,4 @@ export default {
},
],
],
}
})

BIN
bun.lockb

Binary file not shown.

View File

@@ -38,7 +38,6 @@
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/exec": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^10.1.1",
"@tsconfig/strictest": "^2.0.5",
"@types/bun": "^1.1.6",
"conventional-changelog-conventionalcommits": "^7.0.2",
@@ -53,8 +52,5 @@
"@revanced/discord-bot",
"esbuild",
"lefthook"
],
"patchedDependencies": {
"@anolilab/multi-semantic-release@1.1.3": "patches/@anolilab%2Fmulti-semantic-release@1.1.3.patch"
}
]
}

View File

@@ -1,16 +0,0 @@
diff --git a/lib/multi-semantic-release.js b/lib/multi-semantic-release.js
index 1247e618244dc35f6d60d1e484fbd1a84e504b2a..fc8dbf1c418351f2c25698e3fc3fab478693f125 100644
--- a/lib/multi-semantic-release.js
+++ b/lib/multi-semantic-release.js
@@ -114,6 +114,11 @@ async function releasePackage(package_, createInlinePlugin, multiContext, flags)
options.ci = flags.ci === undefined ? options.ci : flags.ci;
options.branches = flags.branches ? castArray(flags.branches) : options.branches;
+ // Patching so plugins from globalOptions are also inherited.
+ // If the third element in the array is set to true, the plugin will not be inherited.
+ options.plugins = [...(multiContext.globalOptions.plugins || []), ...(options.plugins || [])]
+ .filter(plugin => Array.isArray(plugin) ? !plugin[2] : true)
+
// This options are needed for plugins that do not rely on `pluginOptions` and extract them independently.
options._pkgOptions = packageOptions;

View File

@@ -1,4 +1,9 @@
export default {
// @ts-check
/**
* @type {import('semantic-release').Options}
*/
const Options = {
branches: [
'main',
{
@@ -7,7 +12,7 @@ export default {
},
],
plugins:
process.env.RELEASE_WORKFLOW_STEP === 'release'
process.env['RELEASE_WORKFLOW_STEP'] !== 'publish'
? [
[
'@semantic-release/commit-analyzer',
@@ -17,10 +22,16 @@ export default {
],
'@semantic-release/release-notes-generator',
'@semantic-release/changelog',
[
'@semantic-release/npm',
{
npmPublish: false,
}
],
[
'@semantic-release/git',
{
assets: ['README.md', 'CHANGELOG.md', 'package.json'],
assets: ['CHANGELOG.md', 'package.json'],
},
],
[
@@ -34,6 +45,7 @@ export default {
successComment: false,
},
],
// This unfortunately has to run multiple times, even though it needs to run only once.
[
'@saithodev/semantic-release-backmerge',
{
@@ -45,8 +57,19 @@ export default {
],
clearWorkspace: true,
},
true,
],
]
: [],
}
/**
* @param {import('semantic-release').Options} subprojectOptions
* @returns {import('semantic-release').Options}
*/
export default function defineSubprojectReleaseConfig(subprojectOptions) {
return {
...Options,
...subprojectOptions,
plugins: [...(subprojectOptions.plugins || []), ...(Options.plugins || [])],
}
}