Skip to content

Commit 641fc9b

Browse files
committed
AEA-5986 Conditionally add pypi plugin.
1 parent d522293 commit 641fc9b

1 file changed

Lines changed: 96 additions & 90 deletions

File tree

release.config.cjs

Lines changed: 96 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -8,100 +8,106 @@ const mainBranch = process.env.MAIN_BRANCH || "main"
88
const pypiPublish = process.env.PYPI_PUBLISH?.toLowerCase() === 'true' || false
99
const pypiToken = process.env.PYPI_TOKEN
1010

11-
module.exports = {
12-
branches: [
11+
const pypiPlugin = [
12+
"semantic-release-pypi",
13+
{
14+
repoToken: pypiToken
15+
}
16+
]
17+
18+
const plugins = [
19+
[
20+
"@semantic-release/commit-analyzer",
1321
{
14-
name: mainBranch
22+
preset: "eslint",
23+
releaseRules: [
24+
{
25+
tag: "Fix",
26+
release: "patch"
27+
},
28+
{
29+
tag: "Update",
30+
release: "patch"
31+
},
32+
{
33+
tag: "New",
34+
release: "minor"
35+
},
36+
{
37+
tag: "Breaking",
38+
release: "major"
39+
},
40+
{
41+
tag: "Docs",
42+
release: "patch"
43+
},
44+
{
45+
tag: "Build",
46+
release: false
47+
},
48+
{
49+
tag: "Upgrade",
50+
release: "patch"
51+
},
52+
{
53+
tag: "Chore",
54+
release: "patch"
55+
}
56+
]
1557
}
1658
],
17-
plugins: [
18-
[
19-
"@semantic-release/commit-analyzer",
20-
{
21-
preset: "eslint",
22-
releaseRules: [
23-
{
24-
tag: "Fix",
25-
release: "patch"
26-
},
27-
{
28-
tag: "Update",
29-
release: "patch"
30-
},
31-
{
32-
tag: "New",
33-
release: "minor"
34-
},
35-
{
36-
tag: "Breaking",
37-
release: "major"
38-
},
39-
{
40-
tag: "Docs",
41-
release: "patch"
42-
},
43-
{
44-
tag: "Build",
45-
release: false
46-
},
47-
{
48-
tag: "Upgrade",
49-
release: "patch"
50-
},
51-
{
52-
tag: "Chore",
53-
release: "patch"
54-
}
55-
]
56-
}
57-
],
58-
[
59-
"@semantic-release/release-notes-generator",
60-
{
61-
preset: "eslint",
62-
writerOpts: {
63-
commitPartial: commitTemplate
64-
}
65-
}
66-
],
67-
[
68-
"@semantic-release/changelog",
69-
{
70-
changelogFile: "CHANGELOG.md"
71-
}
72-
],
73-
...publish_packages.map(subpackage => [
74-
"@semantic-release/npm",
75-
{
76-
pkgRoot: subpackage
77-
}
78-
]),
79-
[
80-
"semantic-release-pypi",
81-
{
82-
pypiPublish: pypiPublish,
83-
repoToken: pypiToken
59+
[
60+
"@semantic-release/release-notes-generator",
61+
{
62+
preset: "eslint",
63+
writerOpts: {
64+
commitPartial: commitTemplate
8465
}
85-
],
86-
[
87-
"@semantic-release/github",
88-
{
89-
assets: [
66+
}
67+
],
68+
[
69+
"@semantic-release/changelog",
70+
{
71+
changelogFile: "CHANGELOG.md"
72+
}
73+
],
74+
...publish_packages.map(subpackage => [
75+
"@semantic-release/npm",
76+
{
77+
pkgRoot: subpackage
78+
}
79+
]),
80+
[
81+
"@semantic-release/github",
82+
{
83+
assets: [
84+
{
85+
path: "CHANGELOG.md",
86+
label: "CHANGELOG.md"
87+
},
88+
...(process.env.EXTRA_ASSET ? [
9089
{
91-
path: "CHANGELOG.md",
92-
label: "CHANGELOG.md"
93-
},
94-
...(process.env.EXTRA_ASSET ? [
95-
{
96-
path: process.env.EXTRA_ASSET,
97-
label: process.env.EXTRA_ASSET
98-
}
99-
] : [])
100-
],
101-
successComment: false,
102-
failComment: false,
103-
failTitle: false
104-
}
105-
]
90+
path: process.env.EXTRA_ASSET,
91+
label: process.env.EXTRA_ASSET
92+
}
93+
] : [])
94+
],
95+
successComment: false,
96+
failComment: false,
97+
failTitle: false
98+
}
10699
]
100+
]
101+
102+
if (pypiPublish) {
103+
plugins.push(pypiPlugin)
104+
}
105+
106+
module.exports = {
107+
branches: [
108+
{
109+
name: mainBranch
110+
}
111+
],
112+
plugins: plugins
107113
}

0 commit comments

Comments
 (0)