bulk-release 2.11.0 → 2.11.2
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/gh.js +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## [2.11.2](https://github.com/semrel-extra/zx-bulk-release/compare/v2.11.1...v2.11.2) (2023-06-27)
|
|
2
|
+
|
|
3
|
+
### Fixes & improvements
|
|
4
|
+
* fix: handle gh release `upload_url` ([c853ca4](https://github.com/semrel-extra/zx-bulk-release/commit/c853ca4b6978d73402d43c60c30de4523b3c2662))
|
|
5
|
+
|
|
6
|
+
## [2.11.1](https://github.com/semrel-extra/zx-bulk-release/compare/v2.11.0...v2.11.1) (2023-06-27)
|
|
7
|
+
|
|
8
|
+
### Fixes & improvements
|
|
9
|
+
* fix: pass pkg root to `ghAssets` resolver ([b0ba371](https://github.com/semrel-extra/zx-bulk-release/commit/b0ba371263544b7b4081481024fc94413c1a0409))
|
|
10
|
+
|
|
1
11
|
## [2.11.0](https://github.com/semrel-extra/zx-bulk-release/compare/v2.10.0...v2.11.0) (2023-06-27)
|
|
2
12
|
|
|
3
13
|
### Features
|
package/package.json
CHANGED
package/src/main/js/gh.js
CHANGED
|
@@ -27,10 +27,10 @@ export const ghRelease = async (pkg) => {
|
|
|
27
27
|
const {stdout} = await $.o({cwd})`curl -H 'Authorization: token ${ghToken}' -H 'Accept: application/vnd.github.v3+json' https://api.github.com/repos/${repoName}/releases -d ${releaseData}`
|
|
28
28
|
const res = JSON.parse(stdout.toString().trim())
|
|
29
29
|
|
|
30
|
-
log({pkg})('gh release url:', res.url, res.html_url, res.upload_url)
|
|
31
|
-
|
|
32
30
|
if (ghAssets) {
|
|
33
|
-
|
|
31
|
+
// Lol. GH API literally returns pseudourl `...releases/110103594/assets{?name,label}` as shown in the docs
|
|
32
|
+
const uploadUrl = res.upload_url.slice(0, res.upload_url.indexOf('{'))
|
|
33
|
+
await ghUploadAssets({ghToken, ghAssets, uploadUrl, cwd})
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
log({pkg})(`duration gh release: ${Date.now() - now}`)
|
|
@@ -60,10 +60,10 @@ export const ghPages = queuefy(async (pkg) => {
|
|
|
60
60
|
})
|
|
61
61
|
|
|
62
62
|
// https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-asset8
|
|
63
|
-
export const ghPrepareAssets = async (assets) => {
|
|
63
|
+
export const ghPrepareAssets = async (assets, _cwd) => {
|
|
64
64
|
const temp = tempy.temporaryDirectory()
|
|
65
65
|
|
|
66
|
-
await Promise.all(assets.map(async ({name, source = 'target/**/*', zip, cwd}) => {
|
|
66
|
+
await Promise.all(assets.map(async ({name, source = 'target/**/*', zip, cwd = _cwd}) => {
|
|
67
67
|
const patterns = asArray(source)
|
|
68
68
|
const target = path.join(temp, name)
|
|
69
69
|
if (patterns.some(s => s.includes('*'))) {
|
|
@@ -82,12 +82,12 @@ export const ghPrepareAssets = async (assets) => {
|
|
|
82
82
|
return temp
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
export const ghUploadAssets = async ({ghToken, ghAssets, uploadUrl}) => {
|
|
86
|
-
const
|
|
85
|
+
export const ghUploadAssets = async ({ghToken, ghAssets, uploadUrl, cwd}) => {
|
|
86
|
+
const temp = await ghPrepareAssets(ghAssets, cwd)
|
|
87
87
|
|
|
88
88
|
return Promise.all(ghAssets.map(async ({name}) => {
|
|
89
89
|
const url = `${uploadUrl}?name=${name}`
|
|
90
|
-
return $.o({cwd})`curl -H 'Authorization: token ${ghToken}' -H 'Accept: application/vnd.github.v3+json' -H 'Content-Type: application/octet-stream' ${url} --data-binary '@${name}'`
|
|
90
|
+
return $.o({cwd: temp})`curl -H 'Authorization: token ${ghToken}' -H 'Accept: application/vnd.github.v3+json' -H 'Content-Type: application/octet-stream' ${url} --data-binary '@${name}'`
|
|
91
91
|
}))
|
|
92
92
|
}
|
|
93
93
|
|