-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.releaserc.cjs
81 lines (75 loc) · 2.58 KB
/
.releaserc.cjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/** Semantic-Release configuration for GroupBox.Avalonia
* @extends { hceSharedConfig }
*
* <-- TABLE OF CONTENTS -->
* - Insert-Edit Plugins
* - Append Plugins
*/
/**
* @typedef { object } PluginOptionsGit
* @prop { string } message
* @prop {[ string | [string] | {path:string} ]} assets
*/
/**
* @type {import("semantic-release").Options}
*/
const hceSharedConfig = require('@halospv3/hce.shared-config')
if (process.argv.includes("--debug") || process.argv.includes("--verbose")) {
console.info("hce.shared-config:\n" + JSON.stringify(hceSharedConfig, null, 2))
}
/**
* @type { typeof hceSharedConfig.plugins }
*/
const newPlugins = hceSharedConfig.plugins;
const projs = [
'./GroupBox.Avalonia/GroupBox.Avalonia.csproj',
'./GroupBox.Avalonia.Sample/GroupBox.Avalonia.Sample.csproj'];
const dotnetPublish = projs.map(v => `dotnet publish ${v}`).join(" && ");
//#region Insert-Edit Plugins
/* Insert and/or configure plugins. Can be used to load plugin A before plugin B
or edit a plugin's existing configuration */
for (var i = 0; i < newPlugins.length; i++) {
/** e.g.
//#region Git Options | https://github.com/semantic-release/git#options
// if defined without plugin options, replace with tuple-like array with assets option defined.
if (plugins[i] === "@semantic-release/git") {
plugins[i] = [plugins[i], { assets: ["README.md", "CHANGELOG.md"] }]
}
if (plugins[i][0] === "@semantic-release/git") {
// if assets array undefined, define it
if (!plugins[i][1].assets) {
plugins[i][1].assets = [];
}
// ensure README.md is in assets array
if (!plugins[i][1].assets.some(a => a === "README.md" || a.path === "README.md")) {
plugins[i][1].assets.push("README.md");
}
// ensure CHANGELOG.md is in assets array
if (!plugins[i][1].assets.some(a => a === "CHANGELOG.md" || a.path === "CHANGELOG.md")) {
plugins[i][1].assets.push("CHANGELOG.md");
}
}
//#endregion Git Options
*/
}
//#endregion Insert-Edit Plugins
//#region Append Plugins
newPlugins.push(
// APPEND this array of [pluginName, pluginConfig] to plugins
// https://github.com/semantic-release/exec#usage
["@semantic-release/exec", {
// 'ZipPublishDir' zips each publish folder to ./publish/*.zip
prepareCmd: dotnetPublish
}]
)
//#endregion Append Plugins
if (process.argv.includes("--debug") || process.argv.includes("--verbose")) {
console.info("modified plugins array:\n" + JSON.stringify(newPlugins, null, 2))
}
/**
* @type {import("semantic-release").Options}
*/
module.exports = {
extends: "@halospv3/hce.shared-config",
plugins: newPlugins
};