bulk-release 2.2.13 → 2.2.15
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/CHANGELOG.md +10 -0
- package/package.json +1 -1
- package/src/main/js/changelog.js +5 -4
- package/src/main/js/git.js +20 -3
- package/src/main/js/meta.js +7 -10
- package/src/main/js/processor.js +5 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [2.2.15](https://github.com/semrel-extra/zx-bulk-release/compare/v2.2.14...v2.2.15) (2023-03-28)
|
|
2
|
+
|
|
3
|
+
### Fixes & improvements
|
|
4
|
+
* fix: apply queuefy to changelog push ([b8b353d](https://github.com/semrel-extra/zx-bulk-release/commit/b8b353d439916ac57f717a3d463c710702b00d4d))
|
|
5
|
+
|
|
6
|
+
## [2.2.14](https://github.com/semrel-extra/zx-bulk-release/compare/v2.2.13...v2.2.14) (2023-03-28)
|
|
7
|
+
|
|
8
|
+
### Fixes & improvements
|
|
9
|
+
* fix: apply memoize to git config ops ([b46bec0](https://github.com/semrel-extra/zx-bulk-release/commit/b46bec030e711f840f143392c64f6330e6588f8d))
|
|
10
|
+
|
|
1
11
|
## [2.2.13](https://github.com/semrel-extra/zx-bulk-release/compare/v2.2.12...v2.2.13) (2023-03-27)
|
|
2
12
|
|
|
3
13
|
### Fixes & improvements
|
package/package.json
CHANGED
package/src/main/js/changelog.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {$} from 'zx-extra'
|
|
2
|
-
import {
|
|
2
|
+
import {queuefy} from 'queuefy'
|
|
3
3
|
import {fetchRepo, getRepo, pushCommit} from './git.js'
|
|
4
|
-
import {
|
|
4
|
+
import {log} from './log.js'
|
|
5
5
|
import {formatTag} from './meta.js'
|
|
6
|
+
import {msgJoin} from './util.js'
|
|
6
7
|
|
|
7
|
-
export const pushChangelog = async (pkg) => {
|
|
8
|
+
export const pushChangelog = queuefy(async (pkg) => {
|
|
8
9
|
const {absPath: cwd, config: {changelog: opts, gitCommitterEmail, gitCommitterName, ghBasicAuth: basicAuth}} = pkg
|
|
9
10
|
if (!opts) return
|
|
10
11
|
|
|
@@ -18,7 +19,7 @@ export const pushChangelog = async (pkg) => {
|
|
|
18
19
|
|
|
19
20
|
await $.o({cwd: _cwd})`echo ${releaseNotes}"\n$(cat ./${file})" > ./${file}`
|
|
20
21
|
await pushCommit({cwd, branch, msg, gitCommitterEmail, gitCommitterName, basicAuth})
|
|
21
|
-
}
|
|
22
|
+
})
|
|
22
23
|
|
|
23
24
|
export const formatReleaseNotes = async (pkg) => {
|
|
24
25
|
const {name, version, absPath: cwd, config: {ghBasicAuth: basicAuth}} = pkg
|
package/src/main/js/git.js
CHANGED
|
@@ -30,9 +30,8 @@ export const pushCommit = async ({cwd, from, to, branch, origin, msg, ignoreFile
|
|
|
30
30
|
if (from) await copy({baseFrom: cwd, from, baseTo: _cwd, to, ignoreFiles, cwd})
|
|
31
31
|
|
|
32
32
|
try {
|
|
33
|
-
await
|
|
34
|
-
|
|
35
|
-
git add . &&
|
|
33
|
+
await setUserConfig(_cwd, gitCommitterName, gitCommitterEmail)
|
|
34
|
+
await $`git add . &&
|
|
36
35
|
git commit -m ${msg}`
|
|
37
36
|
} catch {
|
|
38
37
|
log({level: 'warn'})(`no changes to commit to ${branch}`)
|
|
@@ -99,3 +98,21 @@ export const getTags = async (cwd, ref = '') =>
|
|
|
99
98
|
(await $.o({cwd})`git tag -l ${ref}`)
|
|
100
99
|
.toString()
|
|
101
100
|
.split('\n')
|
|
101
|
+
|
|
102
|
+
export const pushTag = async ({cwd, tag, gitCommitterName, gitCommitterEmail}) => {
|
|
103
|
+
await setUserConfig(cwd, gitCommitterName, gitCommitterEmail)
|
|
104
|
+
await $.o({cwd})`
|
|
105
|
+
git tag -m ${tag} ${tag} &&
|
|
106
|
+
git push origin ${tag}`
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Memoize prevents .git/config lock
|
|
110
|
+
// https://github.com/qiwi/packasso/actions/runs/4539987310/jobs/8000403413#step:7:282
|
|
111
|
+
export const setUserConfig = memoizeBy(async(cwd, gitCommitterName, gitCommitterEmail) => $.o({cwd})`
|
|
112
|
+
git config user.name ${gitCommitterName} &&
|
|
113
|
+
git config user.email ${gitCommitterEmail}
|
|
114
|
+
`)
|
|
115
|
+
|
|
116
|
+
export const unsetUserConfig = async(cwd) => $.o({cwd})`
|
|
117
|
+
git config --unset user.name &&
|
|
118
|
+
git config --unset user.email`
|
package/src/main/js/meta.js
CHANGED
|
@@ -2,24 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
import {Buffer} from 'node:buffer'
|
|
4
4
|
import {queuefy} from 'queuefy'
|
|
5
|
-
import {
|
|
5
|
+
import {semver, $, fs, path} from 'zx-extra'
|
|
6
6
|
import {log} from './log.js'
|
|
7
|
-
import {fetchRepo, pushCommit, getTags as getGitTags} from './git.js'
|
|
7
|
+
import {fetchRepo, pushCommit, getTags as getGitTags, pushTag} from './git.js'
|
|
8
8
|
import {fetchManifest} from './npm.js'
|
|
9
9
|
|
|
10
|
-
export const
|
|
11
|
-
const {
|
|
10
|
+
export const pushReleaseTag = async (pkg) => {
|
|
11
|
+
const {name, version, config: {gitCommitterEmail, gitCommitterName}} = pkg
|
|
12
12
|
const tag = formatTag({name, version})
|
|
13
|
+
const cwd = pkg.context.git.root
|
|
13
14
|
|
|
14
15
|
pkg.context.git.tag = tag
|
|
15
16
|
log({pkg})(`push release tag ${tag}`)
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
await $`git config user.email ${gitCommitterEmail}`
|
|
20
|
-
await $`git tag -m ${tag} ${tag}`
|
|
21
|
-
await $`git push origin ${tag}`
|
|
22
|
-
})
|
|
18
|
+
await pushTag({cwd, tag, gitCommitterEmail, gitCommitterName})
|
|
19
|
+
}
|
|
23
20
|
|
|
24
21
|
export const pushMeta = queuefy(async (pkg) => {
|
|
25
22
|
log({pkg})('push artifact to branch \'meta\'')
|
package/src/main/js/processor.js
CHANGED
|
@@ -6,9 +6,9 @@ import {pushChangelog} from './changelog.js'
|
|
|
6
6
|
import {getPkgConfig} from './config.js'
|
|
7
7
|
import {topo, traverseDeps, traverseQueue} from './deps.js'
|
|
8
8
|
import {ghPages, ghRelease} from './gh.js'
|
|
9
|
-
import {getRoot, getSha} from './git.js'
|
|
9
|
+
import {getRoot, getSha, unsetUserConfig} from './git.js'
|
|
10
10
|
import {log, createReport} from './log.js'
|
|
11
|
-
import {getLatest, pushMeta,
|
|
11
|
+
import {getLatest, pushMeta, pushReleaseTag} from './meta.js'
|
|
12
12
|
import {fetchPkg, npmPublish} from './npm.js'
|
|
13
13
|
import {memoizeBy, tpl} from './util.js'
|
|
14
14
|
|
|
@@ -62,6 +62,8 @@ export const run = async ({cwd = process.cwd(), env, flags = {}} = {}) => within
|
|
|
62
62
|
.set('error', e)
|
|
63
63
|
.setStatus('failure')
|
|
64
64
|
throw e
|
|
65
|
+
} finally {
|
|
66
|
+
await unsetUserConfig(cwd)
|
|
65
67
|
}
|
|
66
68
|
report
|
|
67
69
|
.setStatus('success')
|
|
@@ -140,7 +142,7 @@ const publish = memoizeBy(async (pkg, run = runCmd) => within(async () => {
|
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
fs.writeJsonSync(pkg.manifestPath, pkg.manifest, {spaces: 2})
|
|
143
|
-
await
|
|
145
|
+
await pushReleaseTag(pkg)
|
|
144
146
|
|
|
145
147
|
await Promise.all([
|
|
146
148
|
pushMeta(pkg),
|