Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #3291 from ethereum/checksums-in-sha256
Browse files Browse the repository at this point in the history
Auto-generating SHA256 checksums
  • Loading branch information
evertonfraga authored Nov 16, 2017
2 parents bde4200 + c623b6d commit ed1578a
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions gulpTasks/publishing.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,11 @@ gulp.task('checksums', (cb) => {
let command;
let argument = '';

switch (process.platform) {
case 'darwin':
command = 'md5';
break;
case 'win32':
if (process.platform === 'win32') {
command = 'certUtil -hashfile';
argument = 'md5';
break;
default:
command = 'md5sum';
argument = 'SHA256';
} else {
command = 'shasum -a 256';
}

files.forEach((file) => {
Expand Down Expand Up @@ -90,14 +85,22 @@ gulp.task('upload-binaries', (cb) => {
})
// append checksums to draft text
.then(() => {
console.info('Appending checksums to release notes...', checksums);
if (draft.body && checksums) {
got.patch(`https://api.github.com/repos/ethereum/mist/releases/${draft.id}?access_token=${GITHUB_TOKEN}`, {
body: JSON.stringify({
tag_name: `v${version}`,
body: `${draft.body}\n\n## Checksums\n\`\`\`\n${checksums.join('')}\`\`\``
// String manipulation to create a checksums table
body: String.concat('File | Checksum (SHA256)\n-- | --', checksums.map((e) => {
const line = e.replace('\n', '').split(' ');
return `<sub>${line[1]}</sub> | <sub>\`${line[0]}\`</sub>`;
}).join('\n'))
})
});
}
})
.catch((err) => {
console.log(err);
});
}
})
Expand Down

0 comments on commit ed1578a

Please sign in to comment.