Skip to content

Commit

Permalink
fix: handle gh release upload_url
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Jun 27, 2023
1 parent 43cfbeb commit c853ca4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/js/gh.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export const ghRelease = async (pkg) => {
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}`
const res = JSON.parse(stdout.toString().trim())

log({pkg})('gh release url:', res.url, res.html_url, res.upload_url)

if (ghAssets) {
await ghUploadAssets({ghToken, uploadUrl: res.upload_url, cwd})
// Lol. GH API literally returns pseudourl `...releases/110103594/assets{?name,label}` as shown in the docs
const uploadUrl = res.upload_url.slice(0, res.upload_url.indexOf('{'))
await ghUploadAssets({ghToken, ghAssets, uploadUrl, cwd})
}

log({pkg})(`duration gh release: ${Date.now() - now}`)
Expand Down

0 comments on commit c853ca4

Please sign in to comment.