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

Auto-generating SHA256 checksums #3291

Merged
merged 2 commits into from
Nov 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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