-
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90bdadd
commit e5851a2
Showing
3 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash -p curl jq nix sd | ||
|
||
set -e | ||
|
||
dirname="$(dirname "$0")" | ||
rootDir="$(git -C "$dirname" rev-parse --show-toplevel)" | ||
pname="besu" | ||
|
||
updateVersion() { | ||
local version=$1 | ||
sd "version = \"[0-9.]*\";" "version = \"$version\";" "${dirname}/default.nix" | ||
} | ||
|
||
updateHash() { | ||
local version=$1 | ||
local url="https://hyperledger.jfrog.io/hyperledger/${pname}-binaries/${pname}/${version}/${pname}-${version}.tar.gz" | ||
local sriHash=$(nix store prefetch-file --json "$url" | jq -r .hash) | ||
sd 'hash = "[a-zA-Z0-9/+-=]*";' "hash = \"$sriHash\";" "${dirname}/default.nix" | ||
} | ||
|
||
currentVersion=$(nix derivation show "${rootDir}#${pname}" | jq -r '.[].env.version') | ||
latestVersion=$(curl -s "https://hyperledger.jfrog.io/artifactory/api/search/latestVersion?g=org.hyperledger.besu.internal&a=besu") | ||
|
||
if [[ "$currentVersion" == "$latestVersion" ]]; then | ||
echo "${pname} is up to date: ${currentVersion}" | ||
exit 0 | ||
fi | ||
|
||
echo "Updating ${pname} from ${currentVersion} to ${latestVersion}" | ||
|
||
updateVersion "$latestVersion" | ||
updateHash "$latestVersion" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env nix-shell | ||
#!nix-shell -i bash -p curl jq nix sd | ||
|
||
set -e | ||
|
||
dirname="$(dirname "$0")" | ||
rootDir="$(git -C "$dirname" rev-parse --show-toplevel)" | ||
pname="teku" | ||
|
||
updateVersion() { | ||
local version=$1 | ||
sd "version = \"[0-9.]*\";" "version = \"$version\";" "${dirname}/default.nix" | ||
} | ||
|
||
updateHash() { | ||
local version=$1 | ||
local url="https://artifacts.consensys.net/public/${pname}/raw/names/${pname}.tar.gz/versions/${version}/${pname}-${version}.tar.gz" | ||
|
||
local output=$(nix store prefetch-file --json "$url") | ||
local sriHash=$(echo "$output" | jq -r .hash) | ||
|
||
sd "\"hash\" = \"[a-zA-Z0-9\/+-=]*\";" "\"hash\" = \"$sriHash\";" "${dirname}/default.nix" | ||
} | ||
|
||
currentVersion=$(nix show-derivation "${rootDir}#${pname}" | jq -r '.[].env.version') | ||
latestVersion=$(curl -s "https://api.github.com/repos/ConsenSys/teku/releases/latest" | jq -r '.tag_name') | ||
|
||
# Optionally strip leading 'v' if present in the tag name | ||
latestVersion=${latestVersion#v} | ||
|
||
if [[ "$currentVersion" == "$latestVersion" ]]; then | ||
echo "${pname} is up to date: ${currentVersion}" | ||
exit 0 | ||
fi | ||
|
||
echo "Updating ${pname} from ${currentVersion} to ${latestVersion}" | ||
|
||
updateVersion "$latestVersion" | ||
updateHash "$latestVersion" | ||
|