Skip to content

Commit

Permalink
feat: Use system curl and sha256sum commands to digest binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
ashchan committed Nov 6, 2019
1 parent acfa6e9 commit 0fa0dd8
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/release-checksums.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0fa0dd8

Please sign in to comment.