-
Notifications
You must be signed in to change notification settings - Fork 1
/
release.config.js
100 lines (90 loc) · 2.59 KB
/
release.config.js
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
var fs = require('fs')
var verifyNugetTokenExists = () => {
if (
process.env.NUGET_API_KEY == null ||
process.env.NUGET_API_KEY === '$(NUGET_API_KEY)'
)
throw new Error(
'A NuGet api key (https://www.nuget.org/account/apikeys) must be created and set in the NUGET_API_KEY environment variable on your CI environment.',
)
}
var verifyNugetPackageExists = (pluginConfig) => {
if (pluginConfig.dryRun) return
var nugetPackages = fs
.readdirSync(__dirname)
.filter((filename) => filename.endsWith('.nupkg'))
if (nugetPackages.length === 0)
throw new Error(`Could not find a nuget package to publish in ${__dirname}`)
}
module.exports = {
verifyConditions: [
verifyNugetTokenExists,
verifyNugetPackageExists,
'@semantic-release/changelog',
'@semantic-release/git',
'@semantic-release/github',
],
prepare: [
'@semantic-release/changelog',
{
path: '@semantic-release/git',
message:
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
},
],
publish: [
{
path: '@semantic-release/github',
assets: '*.*nupkg',
},
{
path: '@semantic-release/exec',
cmd: `dotnet nuget push *.nupkg -k ${process.env.NUGET_API_KEY} -s https://api.nuget.org/v3/index.json`,
},
],
}
var fs = require('fs')
var verifyNugetTokenExists = () => {
if (
process.env.NUGET_API_KEY == null ||
process.env.NUGET_API_KEY === '$(NUGET_API_KEY)'
)
throw new Error(
'A NuGet api key (https://www.nuget.org/account/apikeys) must be created and set in the NUGET_API_KEY environment variable on your CI environment.',
)
}
var verifyNugetPackageExists = (pluginConfig) => {
if (pluginConfig.dryRun) return
var nugetPackages = fs
.readdirSync(__dirname)
.filter((filename) => filename.endsWith('.nupkg'))
if (nugetPackages.length === 0)
throw new Error(`Could not find a nuget package to publish in ${__dirname}`)
}
module.exports = {
verifyConditions: [
verifyNugetTokenExists,
verifyNugetPackageExists,
'@semantic-release/changelog',
'@semantic-release/git',
'@semantic-release/github',
],
prepare: [
'@semantic-release/changelog',
{
path: '@semantic-release/git',
message:
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
},
],
publish: [
{
path: '@semantic-release/github',
assets: '*.*nupkg',
},
{
path: '@semantic-release/exec',
cmd: `dotnet nuget push *.nupkg -k ${process.env.NUGET_API_KEY} -s https://api.nuget.org/v3/index.json`,
},
],
}