Skip to content

Commit 0fa0dd8

Browse files
committed
feat: Use system curl and sha256sum commands to digest binaries
1 parent acfa6e9 commit 0fa0dd8

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

scripts/release-checksums.rb

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
#!/usr/bin/env ruby
22

3+
# curl and sha256sum are required to run this.
4+
35
tag = ARGV[0]
4-
puts "generate release checksums for #{tag}"
6+
puts "Generate release checksums for #{tag}, this could take a while..."
57

68
windows_exe = "https://github.com/nervosnetwork/neuron/releases/download/#{tag}/Neuron-#{tag}-win-installer.exe"
79
macos_zip = "https://github.com/nervosnetwork/neuron/releases/download/#{tag}/Neuron-#{tag}-mac.zip"
810
macos_dmg = "https://github.com/nervosnetwork/neuron/releases/download/#{tag}/Neuron-#{tag}-mac.dmg"
911
linux_appimage = "https://github.com/nervosnetwork/neuron/releases/download/#{tag}/Neuron-#{tag}-linux-x86_64.AppImage"
1012

11-
# TODO: Download binaries and calculate checksums
13+
def get_sha256_checksum(url)
14+
%x(curl -L -s #{url} | sha256sum).split(" ").first
15+
end
1216

13-
windows_exe_sha256 = "{WINDOWS_EXE_SHA256}"
14-
macos_zip_sha256 = "{MACOS_ZIP_SHA256}"
15-
macos_dmg_sha256 = "{MACOS_DMG_SHA256}"
16-
linux_appimage_sha256 = "{LINUX_APPIMAGE_SHA256}"
17+
windows_exe_sha256 = get_sha256_checksum(windows_exe)
18+
macos_zip_sha256 = get_sha256_checksum(macos_zip)
19+
macos_dmg_sha256 = get_sha256_checksum(macos_dmg)
20+
linux_appimage_sha256 = get_sha256_checksum(linux_appimage)
1721

1822
checksums = %(
1923
### Downloads

0 commit comments

Comments
 (0)