From a80ff504e1669ae41d4a3e687cb25c0c0c34812b Mon Sep 17 00:00:00 2001 From: Mark Lee Date: Tue, 9 Jan 2018 17:07:42 -0800 Subject: [PATCH] chore(generic): upgrade github to v13 releases uploadAsset API was changed --- package.json | 3 ++- src/publishers/github.js | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a5f4e0ac2..c26a9d752 100644 --- a/package.json +++ b/package.json @@ -121,12 +121,13 @@ "electron-rebuild": "^1.6.0", "form-data": "^2.1.4", "fs-extra": "^5.0.0", - "github": "^12.0.3", + "github": "^13.1.0", "glob": "^7.1.1", "inquirer": "^5.0.0", "lodash.merge": "^4.6.0", "lodash.template": "^4.4.0", "log-symbols": "^2.0.0", + "mime-types": "^2.1.17", "node-fetch": "^1.6.3", "node-gyp": "^3.4.0", "nugget": "^2.0.1", diff --git a/src/publishers/github.js b/src/publishers/github.js index c2eda8ae3..4c276e3dd 100644 --- a/src/publishers/github.js +++ b/src/publishers/github.js @@ -1,3 +1,5 @@ +import fs from 'fs-extra'; +import mime from 'mime-types'; import path from 'path'; import asyncOra from '../util/ora-handler'; @@ -57,10 +59,10 @@ export default async (artifacts, packageJSON, forgeConfig, authToken, tag) => { return done(); } await github.getGitHub().repos.uploadAsset({ - owner: forgeConfig.github_repository.owner, - repo: forgeConfig.github_repository.name, - id: release.id, - filePath: artifactPath, + url: release.upload_url, + file: fs.createReadStream(artifactPath), + contentType: mime.lookup(artifactPath) || 'application/octet-stream', + contentLength: (await fs.stat(artifactPath)).size, name: path.basename(artifactPath), }); return done();