Skip to content
This repository has been archived by the owner on Feb 27, 2019. It is now read-only.

Commit

Permalink
fix json body arg
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiip committed Jul 20, 2016
1 parent 79d1b49 commit 64cdef6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ const githubUploadUrl = 'https://uploads.github.com/repos/FountainJS/fountain';

function exec(command, args) {
const result = spawn.sync(command, args);
console.log(result.stdout.toString());
try {
return JSON.parse(result.stdout.toString());
} catch (error) {
Expand All @@ -19,11 +18,11 @@ function exec(command, args) {
}

function githubApiRequest(partialUrl, params) {
console.log(params.method, githubApiUrl + partialUrl);
console.log(params.method, githubApiUrl + partialUrl, params.body);
return exec('curl', [
'-H', `Authorization: token ${process.env.GITHUB_TOKEN}`,
'-X', params.method,
'-d', `'${params.body}'`,
'-d', params.body,
githubApiUrl + partialUrl
]);
}
Expand All @@ -38,16 +37,21 @@ function githubUploadRequest(partialUrl, params) {
githubUploadUrl + partialUrl
]);
}
githubApiRequest('/releases', {

const createTagResult = githubApiRequest('/releases', {
method: 'POST',
body: JSON.stringify({tag_name: process.env.TRAVIS_TAG}) // eslint-disable-line camelcase
});

console.log(createTagResult);

const tag = githubApiRequest(`/releases/tags/${process.env.TRAVIS_TAG}`, {
method: 'GET',
body: ''
});

console.log('Tag ID', tag.id);

combinations.full().forEach(options => {
const fileName = `${options.framework}-${options.modules}-${options.js}-${options.css}-${options.router}-${options.sample}.zip`;
const combinationPath = path.join(__dirname, `../dist/${fileName}`);
Expand Down

0 comments on commit 64cdef6

Please sign in to comment.