From 0fa0dd8f2912c9bb393e23eeb8cd080f94d72db2 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 6 Nov 2019 09:04:29 +0900 Subject: [PATCH] feat: Use system curl and sha256sum commands to digest binaries --- scripts/release-checksums.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/release-checksums.rb b/scripts/release-checksums.rb index cccf0f6a49..4f6124fb16 100644 --- a/scripts/release-checksums.rb +++ b/scripts/release-checksums.rb @@ -1,19 +1,23 @@ #!/usr/bin/env ruby +# curl and sha256sum are required to run this. + tag = ARGV[0] -puts "generate release checksums for #{tag}" +puts "Generate release checksums for #{tag}, this could take a while..." windows_exe = "https://github.com/nervosnetwork/neuron/releases/download/#{tag}/Neuron-#{tag}-win-installer.exe" macos_zip = "https://github.com/nervosnetwork/neuron/releases/download/#{tag}/Neuron-#{tag}-mac.zip" macos_dmg = "https://github.com/nervosnetwork/neuron/releases/download/#{tag}/Neuron-#{tag}-mac.dmg" linux_appimage = "https://github.com/nervosnetwork/neuron/releases/download/#{tag}/Neuron-#{tag}-linux-x86_64.AppImage" -# TODO: Download binaries and calculate checksums +def get_sha256_checksum(url) + %x(curl -L -s #{url} | sha256sum).split(" ").first +end -windows_exe_sha256 = "{WINDOWS_EXE_SHA256}" -macos_zip_sha256 = "{MACOS_ZIP_SHA256}" -macos_dmg_sha256 = "{MACOS_DMG_SHA256}" -linux_appimage_sha256 = "{LINUX_APPIMAGE_SHA256}" +windows_exe_sha256 = get_sha256_checksum(windows_exe) +macos_zip_sha256 = get_sha256_checksum(macos_zip) +macos_dmg_sha256 = get_sha256_checksum(macos_dmg) +linux_appimage_sha256 = get_sha256_checksum(linux_appimage) checksums = %( ### Downloads