chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / vi / viddy / update.sh
blob4740effde4a212e71b0cc0b5df16ca80bc86a475
1 #!/usr/bin/env nix-shell
2 #!nix-shell -i bash -p bash nix-update curl coreutils jq common-updater-scripts nix-prefetch
4 # adapted from pkgs/by-name/ya/yazi-unwrapped/update.sh
6 set -eou pipefail
8 NIXPKGS_DIR="$PWD"
9 SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
11 # Get latest release
12 VIDDY_RELEASE=$(
13 curl --silent ${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
14 https://api.github.com/repos/sachaos/viddy/releases/latest
17 # Get release information
18 latestBuildDate=$(echo "$VIDDY_RELEASE" | jq -r ".published_at")
19 latestVersion=$(echo "$VIDDY_RELEASE" | jq -r ".tag_name")
21 latestBuildDate="${latestBuildDate%T*}" # remove the timestamp and get the date
22 latestVersion="${latestVersion:1}" # remove first char 'v'
24 oldVersion=$(nix eval --raw -f "$NIXPKGS_DIR" viddy.version)
26 if [[ "$oldVersion" == "$latestVersion" ]]; then
27 echo "viddy is up-to-date: ${oldVersion}"
28 exit 0
31 echo "Updating viddy"
33 # Version
34 update-source-version viddy "${latestVersion}"
36 pushd "$SCRIPT_DIR"
37 # Build date
38 sed -i 's#env.VERGEN_BUILD_DATE = "[^"]*"#env.VERGEN_BUILD_DATE = "'"${latestBuildDate}"'"#' default.nix
40 # Hashes
41 # https://github.com/msteen/nix-prefetch/issues/51
42 cargoHash=$(nix-prefetch --option extra-experimental-features flakes "{ sha256 }: (import $NIXPKGS_DIR {}).viddy.cargoDeps.overrideAttrs (_: { outputHash = sha256; })")
43 sed -i -E 's#\bcargoHash = ".*?"#cargoHash = "'"$cargoHash"'"#' default.nix
44 popd