bulk-release 2.11.1 → 2.11.3

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 CHANGED
@@ -1,3 +1,13 @@
1
+ ## [2.11.3](https://github.com/semrel-extra/zx-bulk-release/compare/v2.11.2...v2.11.3) (2023-06-27)
2
+
3
+ ### Fixes & improvements
4
+ * fix: apply dir strip to tar inners ([3f5ccd8](https://github.com/semrel-extra/zx-bulk-release/commit/3f5ccd89134331604859969c8d10887d27d9aa6f))
5
+
6
+ ## [2.11.2](https://github.com/semrel-extra/zx-bulk-release/compare/v2.11.1...v2.11.2) (2023-06-27)
7
+
8
+ ### Fixes & improvements
9
+ * fix: handle gh release `upload_url` ([c853ca4](https://github.com/semrel-extra/zx-bulk-release/commit/c853ca4b6978d73402d43c60c30de4523b3c2662))
10
+
1
11
  ## [2.11.1](https://github.com/semrel-extra/zx-bulk-release/compare/v2.11.0...v2.11.1) (2023-06-27)
2
12
 
3
13
  ### Fixes & improvements
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bulk-release",
3
3
  "alias": "bulk-release",
4
- "version": "2.11.1",
4
+ "version": "2.11.3",
5
5
  "description": "zx-based alternative for multi-semantic-release",
6
6
  "type": "module",
7
7
  "exports": {
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
- await ghUploadAssets({ghToken, uploadUrl: res.upload_url, cwd})
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}`)
@@ -63,20 +63,24 @@ export const ghPages = queuefy(async (pkg) => {
63
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 = _cwd}) => {
66
+ await Promise.all(assets.map(async ({name, source = 'target/**/*', zip, cwd = _cwd, strip = true}) => {
67
67
  const patterns = asArray(source)
68
68
  const target = path.join(temp, name)
69
69
  if (patterns.some(s => s.includes('*'))) {
70
70
  zip = true
71
71
  }
72
- const files = await glob(patterns, {cwd, absolute: true, onlyFiles: true})
73
-
72
+ const files = await glob(patterns, {cwd, absolute: false, onlyFiles: true})
74
73
  if (!zip && files.length === 1) {
75
- await fs.copy(files[0], target)
74
+ await fs.copy(path.join(cwd, files[0]), target)
76
75
  return
77
76
  }
78
77
 
79
- return $.raw`tar -C ${cwd} -cv${zip ? 'z' : ''}f ${target} ${files.join(' ')}`
78
+ const common = files.length === 1
79
+ ? files[0].lastIndexOf('/') + 1
80
+ : [...(files[0])].findIndex((c, i) => files.some(f => f.charAt(i) !== c))
81
+ const prefix = files[0].slice(0, common)
82
+
83
+ return $.raw`tar -C ${common ? path.join(cwd, prefix) : cwd} -cv${zip ? 'z' : ''}f ${target} ${files.map(f => common ? f.slice(common) : f).join(' ')}`
80
84
  }))
81
85
 
82
86
  return temp