@npmcli/template-oss 4.19.0 → 4.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -11
- package/bin/release-manager.js +23 -271
- package/bin/release-please.js +20 -55
- package/lib/config.js +98 -119
- package/lib/content/{_job-matrix.yml → _job-matrix-yml.hbs} +1 -1
- package/lib/content/_job-release-integration-yml.hbs +51 -0
- package/lib/content/{_job.yml → _job-yml.hbs} +1 -1
- package/lib/content/_step-node-yml.hbs +15 -0
- package/lib/content/_steps-setup-yml.hbs +15 -0
- package/lib/content/action-create-check-yml.hbs +50 -0
- package/lib/content/action-install-latest-npm-yml.hbs +55 -0
- package/lib/content/{audit.yml → audit-yml.hbs} +2 -2
- package/lib/content/ci-release-yml.hbs +49 -0
- package/lib/content/ci-yml.hbs +13 -0
- package/lib/content/{codeql-analysis.yml → codeql-analysis-yml.hbs} +1 -1
- package/lib/content/{eslintrc.js → eslintrc-js.hbs} +11 -1
- package/lib/content/{gitignore → gitignore.hbs} +2 -0
- package/lib/content/index.js +55 -40
- package/lib/content/{pkg.json → package-json.hbs} +19 -5
- package/lib/content/{post-dependabot.yml → post-dependabot-yml.hbs} +1 -1
- package/lib/content/{pull-request.yml → pull-request-yml.hbs} +3 -5
- package/lib/content/release-integration-yml.hbs +24 -0
- package/lib/content/release-please-config-json.hbs +23 -0
- package/lib/content/release-yml.hbs +245 -0
- package/lib/content/tsconfig-json.hbs +17 -0
- package/lib/release/changelog.js +184 -0
- package/lib/release/node-workspace-format.js +107 -0
- package/lib/release/node-workspace.js +95 -0
- package/lib/release/release-manager.js +287 -0
- package/lib/release/release-please.js +180 -0
- package/lib/release/util.js +42 -0
- package/lib/util/files.js +29 -20
- package/lib/util/get-cmd-path.js +36 -0
- package/lib/util/git.js +6 -2
- package/lib/util/import-or-require.js +29 -0
- package/lib/util/parser.js +6 -1
- package/lib/util/path.js +13 -0
- package/lib/util/template.js +9 -6
- package/package.json +21 -13
- package/lib/content/_job-release-integration.yml +0 -59
- package/lib/content/_step-checks.yml +0 -54
- package/lib/content/_step-node.yml +0 -57
- package/lib/content/_steps-setup.yml +0 -6
- package/lib/content/ci-release.yml +0 -37
- package/lib/content/ci.yml +0 -13
- package/lib/content/release-please-config.json +0 -13
- package/lib/content/release.yml +0 -217
- package/lib/release-please/changelog.js +0 -92
- package/lib/release-please/github.js +0 -72
- package/lib/release-please/index.js +0 -262
- package/lib/release-please/node-workspace.js +0 -192
- package/lib/release-please/util.js +0 -14
- package/lib/release-please/version.js +0 -103
- /package/lib/content/{CODEOWNERS → CODEOWNERS.hbs} +0 -0
- /package/lib/content/{CODE_OF_CONDUCT.md → CODE_OF_CONDUCT-md.hbs} +0 -0
- /package/lib/content/{CONTRIBUTING.md → CONTRIBUTING-md.hbs} +0 -0
- /package/lib/content/{LICENSE.md → LICENSE-md.hbs} +0 -0
- /package/lib/content/{SECURITY.md → SECURITY-md.hbs} +0 -0
- /package/lib/content/{_on-ci.yml → _on-ci-yml.hbs} +0 -0
- /package/lib/content/{_step-audit.yml → _step-audit-yml.hbs} +0 -0
- /package/lib/content/{_step-deps.yml → _step-deps-yml.hbs} +0 -0
- /package/lib/content/{_step-git.yml → _step-git-yml.hbs} +0 -0
- /package/lib/content/{_step-lint.yml → _step-lint-yml.hbs} +0 -0
- /package/lib/content/{_step-test.yml → _step-test-yml.hbs} +0 -0
- /package/lib/content/{bug.yml → bug-yml.hbs} +0 -0
- /package/lib/content/{commitlintrc.js → commitlintrc-js.hbs} +0 -0
- /package/lib/content/{config.yml → config-yml.hbs} +0 -0
- /package/lib/content/{dependabot.yml → dependabot-yml.hbs} +0 -0
- /package/lib/content/{npmrc → npmrc.hbs} +0 -0
- /package/lib/content/{release-please-manifest.json → release-please-manifest-json.hbs} +0 -0
- /package/lib/content/{settings.yml → settings-yml.hbs} +0 -0
- /package/lib/content/{tap.json → tap-json.hbs} +0 -0
package/README.md
CHANGED
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
This module bundles the npm CLI team's basics for package development into a
|
|
4
4
|
single devDependency.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
> [!WARNING]
|
|
7
|
+
> THESE CHANGES WILL OVERWRITE LOCAL FILES AND SETTINGS
|
|
8
|
+
|
|
9
|
+
> [!IMPORTANT]
|
|
10
|
+
> This package does not follow semantic versioning for its API. This package is designed to be installed with `--save-exact` and therefore will make breaking API changes outside of major versions, including `engines` narrowing. Major versions are reserved for breaking changes to files written to a repo by this package.
|
|
7
11
|
|
|
8
12
|
### Configuration
|
|
9
13
|
|
|
@@ -60,21 +64,21 @@ any of the same settings in the root.
|
|
|
60
64
|
### Content
|
|
61
65
|
|
|
62
66
|
All the templated content for this repo lives in
|
|
63
|
-
[`lib/content/`](./lib/content/). The `index.js`
|
|
67
|
+
[`lib/content/`](./lib/content/). The [`index.js`](./lib/content/index.js) file
|
|
64
68
|
controls how and where this content is written.
|
|
65
69
|
|
|
66
70
|
Content files can be overwritten or merged with the existing target file.
|
|
67
|
-
|
|
71
|
+
Merging is only supported for some types of files (ini, yaml, json, package.json)
|
|
68
72
|
|
|
69
73
|
Each content file goes through the following pipeline:
|
|
70
74
|
|
|
71
75
|
1. It is read from its source location
|
|
72
|
-
|
|
73
|
-
config (with some derived values generated in [`config.js`](./lib/config.js)
|
|
74
|
-
|
|
76
|
+
2. It is compiled using [Handlebars](https://handlebarsjs.com/) with the variables from each packages's
|
|
77
|
+
config (with some derived values generated in [`config.js`](./lib/config.js))
|
|
78
|
+
3. It is parsed based on its file extension in
|
|
75
79
|
[`parser.js`](./lib/util/parser.js)
|
|
76
|
-
|
|
77
|
-
|
|
80
|
+
4. Additional logic is applied by the parser
|
|
81
|
+
5. It is written to its target location
|
|
78
82
|
|
|
79
83
|
### Usage
|
|
80
84
|
|
|
@@ -82,7 +86,7 @@ This package provides two bin scripts:
|
|
|
82
86
|
|
|
83
87
|
#### `template-oss-check`
|
|
84
88
|
|
|
85
|
-
This will check if any of the applied files
|
|
89
|
+
This will check if any of the applied files differ from the target content,
|
|
86
90
|
or if any of the other associated checks fail. The diffs of each file or check
|
|
87
91
|
will be reported with instructions on how to fix it.
|
|
88
92
|
|
|
@@ -92,7 +96,7 @@ This will write all source files to their target locations in the cwd. It will
|
|
|
92
96
|
do nothing if `package.json#templateOSS.version` is the same as the version
|
|
93
97
|
being run. This can be overridden by `--force`.
|
|
94
98
|
|
|
95
|
-
This is the script that is run on `
|
|
99
|
+
This is the script that is run on `postinstall`.
|
|
96
100
|
|
|
97
101
|
### Extending
|
|
98
102
|
|
|
@@ -100,7 +104,7 @@ This is the script that is run on `postinsall`.
|
|
|
100
104
|
|
|
101
105
|
This directory is where all the logic for applying files lives. It should be
|
|
102
106
|
possible to add new files without modifying anything in this directory. To add a
|
|
103
|
-
file, add the templated file to `lib/content/$FILENAME` and
|
|
107
|
+
file, add the templated file to `lib/content/$FILENAME` and an entry for it in
|
|
104
108
|
`lib/content/index.js` depending on where and when it should be written (root vs
|
|
105
109
|
workspace, repo vs module, add vs remove, etc).
|
|
106
110
|
|
|
@@ -119,3 +123,23 @@ trivial to swap out this content directory for a different one as it is only
|
|
|
119
123
|
referenced in a single place in `lib/config.js`. However, it's not currently
|
|
120
124
|
possible to change this value at runtime, but that might become possible in
|
|
121
125
|
future versions of this package.
|
|
126
|
+
|
|
127
|
+
### Testing
|
|
128
|
+
|
|
129
|
+
The files `test/release/release-manager.js` and `test/release/release-please.js`
|
|
130
|
+
use recorded `nock` fixtures to generate snapshots. To update these fixtures run:
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
GITHUB_TOKEN=$(gh auth token) npm run test:record --- test/release/release-{please,manager}.js
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
If you only need to update fixtures for one, it's best to only run that single
|
|
137
|
+
test file.
|
|
138
|
+
|
|
139
|
+
#### `test/release/release-please.js`
|
|
140
|
+
|
|
141
|
+
This test file uses the repo `npm/npm-cli-release-please` to record its
|
|
142
|
+
fixtures. It expects `https://github.com/npm/npm-cli-release-please` to be
|
|
143
|
+
checked out in a sibling directory to this repo. It also needs the current
|
|
144
|
+
branch set to `template-oss-mock-testing-branch-do-not-delete` before the tests
|
|
145
|
+
are run.
|
package/bin/release-manager.js
CHANGED
|
@@ -1,277 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const { join } = require('path')
|
|
3
|
+
const core = require('@actions/core')
|
|
4
|
+
const { parseArgs } = require('util')
|
|
5
|
+
const ReleaseManager = require('../lib/release/release-manager')
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const ROOT = process.cwd()
|
|
11
|
-
const pkg = require(join(ROOT, 'package.json'))
|
|
12
|
-
|
|
13
|
-
const args = process.argv.slice(2).reduce((acc, a) => {
|
|
14
|
-
const [k, v] = a.replace(/^--/g, '').split('=')
|
|
15
|
-
acc[k] = v === 'true'
|
|
16
|
-
return acc
|
|
17
|
-
}, {})
|
|
18
|
-
|
|
19
|
-
/* eslint-disable max-len */
|
|
20
|
-
const MANUAL_PUBLISH_STEPS = `
|
|
21
|
-
1. Checkout the release branch and test
|
|
22
|
-
|
|
23
|
-
\`\`\`sh
|
|
24
|
-
gh pr checkout <PR-NUMBER> --force
|
|
25
|
-
npm ${args.lockfile ? 'ci' : 'update'}
|
|
26
|
-
npm test
|
|
27
|
-
gh pr checks <PR-NUMBER> -R {NWO} --watch
|
|
28
|
-
\`\`\`
|
|
29
|
-
|
|
30
|
-
1. Publish workspaces
|
|
31
|
-
|
|
32
|
-
\`\`\`sh
|
|
33
|
-
npm publish -w <WS-PKG-N>
|
|
34
|
-
\`\`\`
|
|
35
|
-
|
|
36
|
-
1. Publish
|
|
37
|
-
|
|
38
|
-
\`\`\`sh
|
|
39
|
-
npm publish <PUBLISH-FLAGS>
|
|
40
|
-
\`\`\`
|
|
41
|
-
|
|
42
|
-
1. Merge release PR
|
|
43
|
-
|
|
44
|
-
\`\`\`sh
|
|
45
|
-
gh pr merge <PR-NUMBER> -R {NWO} --rebase
|
|
46
|
-
git checkout <BASE-BRANCH>
|
|
47
|
-
git fetch
|
|
48
|
-
git reset --hard origin/<BASE-BRANCH>
|
|
49
|
-
\`\`\`
|
|
50
|
-
`
|
|
51
|
-
|
|
52
|
-
const AUTO_PUBLISH_STEPS = `
|
|
53
|
-
1. Merge release PR :rotating_light: Merging this will auto publish :rotating_light:
|
|
54
|
-
|
|
55
|
-
\`\`\`sh
|
|
56
|
-
gh pr merge <PR-NUMBER> -R {NWO} --rebase
|
|
57
|
-
\`\`\`
|
|
58
|
-
`
|
|
59
|
-
|
|
60
|
-
const DEFAULT_RELEASE_PROCESS = (args.publish ? AUTO_PUBLISH_STEPS : MANUAL_PUBLISH_STEPS) + `
|
|
61
|
-
1. Check For Release Tags
|
|
62
|
-
|
|
63
|
-
Release Please will run on the just pushed release commit and create GitHub releases and tags for each package.
|
|
64
|
-
|
|
65
|
-
\`\`\`
|
|
66
|
-
gh run watch -R {NWO} $(gh run list -R {NWO} -w release -b <BASE-BRANCH> -L 1 --json databaseId -q ".[0].databaseId")
|
|
67
|
-
\`\`\`
|
|
68
|
-
`
|
|
69
|
-
/* eslint-enable max-len */
|
|
70
|
-
|
|
71
|
-
const getReleaseProcess = async ({ owner, repo }) => {
|
|
72
|
-
const RELEASE_LIST_ITEM = /^\d+\.\s/gm
|
|
73
|
-
|
|
74
|
-
log(`Fetching release process from:`, owner, repo, 'wiki')
|
|
75
|
-
|
|
76
|
-
let releaseProcess = ''
|
|
77
|
-
try {
|
|
78
|
-
releaseProcess = await new Promise((resolve, reject) => {
|
|
79
|
-
require('https')
|
|
80
|
-
.get(`https://raw.githubusercontent.com/wiki/${owner}/${repo}/Release-Process.md`, resp => {
|
|
81
|
-
let d = ''
|
|
82
|
-
resp.on('data', c => (d += c))
|
|
83
|
-
resp.on('end', () => {
|
|
84
|
-
if (resp.statusCode !== 200) {
|
|
85
|
-
reject(new Error(`${resp.req.protocol + resp.req.host + resp.req.path}: ${d}`))
|
|
86
|
-
} else {
|
|
87
|
-
resolve(d)
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
})
|
|
91
|
-
.on('error', reject)
|
|
92
|
-
})
|
|
93
|
-
} catch (e) {
|
|
94
|
-
log('Release wiki not found', e.message)
|
|
95
|
-
log('Using default release process')
|
|
96
|
-
releaseProcess = DEFAULT_RELEASE_PROCESS.replace(/\{NWO\}/g, `${owner}/${repo}`).trim() + '\n'
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// XXX: the release steps need to always be the last thing in the doc for this to work
|
|
100
|
-
const releaseLines = releaseProcess.split('\n')
|
|
101
|
-
const releaseStartLine = releaseLines.reduce((acc, line, index) =>
|
|
102
|
-
line.match(/^#+\s/) ? index : acc, 0)
|
|
103
|
-
const section = releaseLines.slice(releaseStartLine).join('\n')
|
|
104
|
-
|
|
105
|
-
return section.split({
|
|
106
|
-
[Symbol.split] (str) {
|
|
107
|
-
const [, ...matches] = str.split(RELEASE_LIST_ITEM)
|
|
108
|
-
log(`Found ${matches.length} release items`)
|
|
109
|
-
return matches.map((m) => `- [ ] <STEP_INDEX>. ${m}`.trim())
|
|
110
|
-
},
|
|
111
|
-
})
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const getPrReleases = async (pr) => {
|
|
115
|
-
const RELEASE_SEPARATOR = /<details><summary>.*<\/summary>/g
|
|
116
|
-
const MONO_VERSIONS = /<details><summary>(?:(.*?):\s)?(.*?)<\/summary>/
|
|
117
|
-
const ROOT_VERSION = /\n##\s\[(.*?)\]/
|
|
118
|
-
|
|
119
|
-
const workspaces = [...await mapWorkspaces({ pkg: pkg, cwd: ROOT })].reduce((acc, [k]) => {
|
|
120
|
-
const wsComponentName = k.startsWith('@') ? k.split('/')[1] : k
|
|
121
|
-
acc[wsComponentName] = k
|
|
122
|
-
return acc
|
|
123
|
-
}, {})
|
|
124
|
-
|
|
125
|
-
const getReleaseInfo = ({ name, version: rawVersion }) => {
|
|
126
|
-
const version = semver.parse(rawVersion)
|
|
127
|
-
const prerelease = !!version.prerelease.length
|
|
128
|
-
const tag = `${name ? `${name}-` : ''}v${rawVersion}`
|
|
129
|
-
const workspace = workspaces[name]
|
|
130
|
-
|
|
131
|
-
return {
|
|
132
|
-
name,
|
|
133
|
-
tag,
|
|
134
|
-
prerelease,
|
|
135
|
-
version: rawVersion,
|
|
136
|
-
major: version.major,
|
|
137
|
-
url: `https://github.com/${pr.base.repo.full_name}/releases/tag/${tag}`,
|
|
138
|
-
flags: `${name ? `-w ${workspace}` : ''} ${prerelease ? `--tag prerelease` : ''}`.trim(),
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const releases = pr.body.match(RELEASE_SEPARATOR)
|
|
143
|
-
|
|
144
|
-
if (!releases) {
|
|
145
|
-
log('Found no monorepo, checking for single root version')
|
|
146
|
-
const [, version] = pr.body.match(ROOT_VERSION) || []
|
|
147
|
-
|
|
148
|
-
if (!version) {
|
|
149
|
-
throw new Error('Could not find version with:', ROOT_VERSION)
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
log('Found version', version)
|
|
153
|
-
return [getReleaseInfo({ version })]
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
log(`Found ${releases.length} releases`)
|
|
157
|
-
|
|
158
|
-
return releases.reduce((acc, r) => {
|
|
159
|
-
const [, name, version] = r.match(MONO_VERSIONS)
|
|
160
|
-
const release = getReleaseInfo({ name, version })
|
|
161
|
-
|
|
162
|
-
if (!name) {
|
|
163
|
-
log('Found root', release)
|
|
164
|
-
acc[0] = release
|
|
165
|
-
} else {
|
|
166
|
-
log('Found workspace', release)
|
|
167
|
-
acc[1].push(release)
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return acc
|
|
171
|
-
}, [null, []])
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
const appendToComment = async ({ github, commentId, title, body }) => {
|
|
175
|
-
if (!commentId) {
|
|
176
|
-
log(`No comment id, skipping append to comment`)
|
|
177
|
-
return
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
const { data: comment } = await github.rest.issues.getComment({
|
|
181
|
-
...github.repo,
|
|
182
|
-
comment_id: commentId,
|
|
183
|
-
})
|
|
184
|
-
|
|
185
|
-
const hasAppended = comment.body.includes(title)
|
|
186
|
-
|
|
187
|
-
log('Found comment with id:', commentId)
|
|
188
|
-
log(hasAppended ? 'Comment has aready been appended, replacing' : 'Appending to comment')
|
|
189
|
-
|
|
190
|
-
const prefix = hasAppended
|
|
191
|
-
? comment.body.split(title)[0]
|
|
192
|
-
: comment.body
|
|
193
|
-
|
|
194
|
-
return github.rest.issues.updateComment({
|
|
195
|
-
...github.repo,
|
|
196
|
-
comment_id: commentId,
|
|
197
|
-
body: [prefix, title, body].join('\n\n'),
|
|
198
|
-
})
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
const main = async (env) => {
|
|
7
|
+
ReleaseManager.run({
|
|
202
8
|
// These env vars are set by the release.yml workflow from template-oss
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
const { data: pr } = await github.rest.pulls.get({
|
|
221
|
-
...github.repo,
|
|
222
|
-
pull_number: RELEASE_PR_NUMBER,
|
|
9
|
+
token: process.env.GITHUB_TOKEN,
|
|
10
|
+
repo: process.env.GITHUB_REPOSITORY,
|
|
11
|
+
cwd: process.cwd(),
|
|
12
|
+
...parseArgs({
|
|
13
|
+
options: {
|
|
14
|
+
pr: { type: 'string' },
|
|
15
|
+
backport: { type: 'string' },
|
|
16
|
+
defaultTag: { type: 'string' },
|
|
17
|
+
lockfile: { type: 'boolean' },
|
|
18
|
+
publish: { type: 'boolean' },
|
|
19
|
+
},
|
|
20
|
+
}).values,
|
|
21
|
+
})
|
|
22
|
+
.then((result) => {
|
|
23
|
+
core.setOutput('result', result)
|
|
24
|
+
return null
|
|
223
25
|
})
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const RELEASE_OMIT_PRERELEASE = '> NOT FOR PRERELEASE'
|
|
228
|
-
const RELEASE_OMIT_WORKSPACES = 'Publish workspaces'
|
|
229
|
-
const releaseItems = (await getReleaseProcess({ owner, repo }))
|
|
230
|
-
.filter((item) => {
|
|
231
|
-
if (release.prerelease && item.includes(RELEASE_OMIT_PRERELEASE)) {
|
|
232
|
-
return false
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
if (!workspaces.length && item.includes(RELEASE_OMIT_WORKSPACES)) {
|
|
236
|
-
return false
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
return true
|
|
240
|
-
})
|
|
241
|
-
.map((item, index) => item.replace('<STEP_INDEX>', index + 1))
|
|
242
|
-
|
|
243
|
-
log(
|
|
244
|
-
`Filtered ${releaseItems.length} release process items:\n`,
|
|
245
|
-
releaseItems.map(r => r.split('\n')[0].replace('- [ ] ', '')).join(', ')
|
|
246
|
-
)
|
|
247
|
-
|
|
248
|
-
const releaseTitle = `### Release Checklist for ${release.tag}`
|
|
249
|
-
const releaseChecklist = releaseItems
|
|
250
|
-
.join('\n\n')
|
|
251
|
-
.replace(/<PR-NUMBER>/g, RELEASE_PR_NUMBER)
|
|
252
|
-
.replace(/<RELEASE-BRANCH>/g, pr.head.ref)
|
|
253
|
-
.replace(/<BASE-BRANCH>/g, pr.base.ref)
|
|
254
|
-
.replace(/<MAJOR>/g, release.major)
|
|
255
|
-
.replace(/<X\.Y\.Z>/g, release.version)
|
|
256
|
-
.replace(/<GITHUB-RELEASE-LINK>/g, release.url)
|
|
257
|
-
.replace(/<PUBLISH-FLAGS>/g, release.flags)
|
|
258
|
-
.replace(/^(\s*\S.*)(-w <WS-PKG-N>)$/gm, workspaces.map(w => `$1${w.flags}`).join('\n'))
|
|
259
|
-
.trim()
|
|
260
|
-
|
|
261
|
-
await appendToComment({
|
|
262
|
-
github,
|
|
263
|
-
commentId: RELEASE_COMMENT_ID,
|
|
264
|
-
title: releaseTitle,
|
|
265
|
-
body: releaseChecklist,
|
|
26
|
+
.catch(err => {
|
|
27
|
+
core.setFailed('Release Manager failed')
|
|
28
|
+
core.error(err)
|
|
266
29
|
})
|
|
267
|
-
|
|
268
|
-
if (!RELEASE_COMMENT_ID) {
|
|
269
|
-
console.log(releaseChecklist)
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
main(process.env)
|
|
274
|
-
// This is part of the release CI and is for posting a release manager
|
|
275
|
-
// comment to the issue but we dont want it to ever fail the workflow so
|
|
276
|
-
// just log but dont set the error code
|
|
277
|
-
.catch(err => console.error(err))
|
package/bin/release-please.js
CHANGED
|
@@ -1,75 +1,40 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const core = require('@actions/core')
|
|
4
|
-
const
|
|
4
|
+
const { parseArgs } = require('util')
|
|
5
|
+
const ReleasePlease = require('../lib/release/release-please.js')
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
const [branch, forcePullRequest] = process.argv.slice(2)
|
|
8
|
-
|
|
9
|
-
const debugPr = (val) => {
|
|
10
|
-
if (dryRun) {
|
|
11
|
-
console.log('PR:', val.title.toString())
|
|
12
|
-
console.log('='.repeat(40))
|
|
13
|
-
console.log(val.body.toString())
|
|
14
|
-
console.log('='.repeat(40))
|
|
15
|
-
for (const update of val.updates.filter(u => u.updater.changelogEntry)) {
|
|
16
|
-
console.log('CHANGELOG:', update.path)
|
|
17
|
-
console.log('-'.repeat(40))
|
|
18
|
-
console.log(update.updater.changelogEntry)
|
|
19
|
-
console.log('-'.repeat(40))
|
|
20
|
-
}
|
|
21
|
-
for (const update of val.updates.filter(u => u.updater.rawContent)) {
|
|
22
|
-
console.log('package:', update.path)
|
|
23
|
-
console.log('-'.repeat(40))
|
|
24
|
-
console.log(JSON.parse(update.updater.rawContent).name)
|
|
25
|
-
console.log(JSON.parse(update.updater.rawContent).version)
|
|
26
|
-
console.log('-'.repeat(40))
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const debugRelease = (val) => {
|
|
32
|
-
if (dryRun) {
|
|
33
|
-
console.log('ROOT RELEASE:', JSON.stringify(val, null, 2))
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const debugReleases = (val) => {
|
|
38
|
-
if (dryRun) {
|
|
39
|
-
console.log('ALL RELEASES:', JSON.stringify(val, null, 2))
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
main({
|
|
7
|
+
ReleasePlease.run({
|
|
44
8
|
token: process.env.GITHUB_TOKEN,
|
|
45
9
|
repo: process.env.GITHUB_REPOSITORY,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
10
|
+
...parseArgs({
|
|
11
|
+
options: {
|
|
12
|
+
branch: { type: 'string' },
|
|
13
|
+
backport: { type: 'string' },
|
|
14
|
+
defaultTag: { type: 'string' },
|
|
15
|
+
},
|
|
16
|
+
}).values,
|
|
17
|
+
// This is mostly for testing and debugging. Use environs with the format
|
|
18
|
+
// `RELEASE_PLEASE_<manfiestOverrideConfigName>`
|
|
19
|
+
// (eg`RELEASE_PLEASE_lastReleaseSha=<SHA>`) to set one-off config items for
|
|
20
|
+
// the release please run without needing to commit and push the config.
|
|
21
|
+
overrides: Object.fromEntries(Object.entries(process.env)
|
|
22
|
+
.filter(([k, v]) => k.startsWith('RELEASE_PLEASE_') && v != null)
|
|
23
|
+
.map(([k, v]) => [k.replace('RELEASE_PLEASE_', ''), v])),
|
|
24
|
+
}).then(({ pr, releases }) => {
|
|
50
25
|
if (pr) {
|
|
51
|
-
debugPr(pr)
|
|
52
26
|
core.setOutput('pr', JSON.stringify(pr))
|
|
53
27
|
core.setOutput('pr-branch', pr.headBranchName)
|
|
54
28
|
core.setOutput('pr-number', pr.number)
|
|
55
29
|
core.setOutput('pr-sha', pr.sha)
|
|
56
30
|
}
|
|
57
31
|
|
|
58
|
-
if (release) {
|
|
59
|
-
debugRelease(release)
|
|
60
|
-
core.setOutput('release', JSON.stringify(release))
|
|
61
|
-
}
|
|
62
|
-
|
|
63
32
|
if (releases) {
|
|
64
|
-
debugReleases(releases)
|
|
65
33
|
core.setOutput('releases', JSON.stringify(releases))
|
|
66
34
|
}
|
|
67
35
|
|
|
68
36
|
return null
|
|
69
37
|
}).catch(err => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
} else {
|
|
73
|
-
core.setFailed(`failed: ${err}`)
|
|
74
|
-
}
|
|
38
|
+
core.setFailed('Release Please failed')
|
|
39
|
+
core.error(err)
|
|
75
40
|
})
|