chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / by-name / ya / yandex-music / update.sh
blob92ebdb8d8a2e2a4c24b34911a494d1f7cad25a2f
1 #!/usr/bin/env nix-shell
2 #! nix-shell -i bash -p common-updater-scripts fd jq
4 set -eou pipefail
6 OWNER="cucumber-sp"
7 REPO="yandex-music-linux"
8 URL="https://api.github.com/repos/$OWNER/$REPO"
9 RAW="https://raw.githubusercontent.com/$OWNER/$REPO"
11 latest_release="$(curl --silent "$URL/releases/latest")"
12 latest_tag="$(curl --silent "$URL/tags?per_page=1")"
13 commit_hash="$(jq -r '.[0].commit.sha' <<<"$latest_tag")"
14 latest_commit="$(curl --silent "$URL/commits/$commit_hash"'')"
15 commit_message="$(jq -r '.commit.message' <<<"$latest_commit")"
17 tag=$(jq -r '.tag_name' <<<"$latest_release")
18 # drop 'v' prefix
19 version="${tag#v}"
21 branch=$(jq -r '.target_commitish' <<<"$latest_release")
23 date=$(jq -r '.created_at' <<<"$latest_release")
24 # truncate time
25 date=${date%T*}
27 # update version; otherwise fail
28 update-source-version yandex-music "$version" --ignore-same-hash
30 # set yandex-music dir
31 dir="pkgs/by-name/ya/yandex-music"
33 echo -e '{
34 "branch": "'"$branch"'",
35 "commit_hash": "'"$commit_hash"'",
36 "commit_message": "'"$commit_message"'",
37 "date": "'"$date"'",
38 "tag": "'"$tag"'"
39 }' >"$dir/info.json" || echo "Please run the script in the root of the Nixpkgs repo"
41 curl --silent "$RAW/$commit_hash/utility/version_info.json" |\
42 jq . > "$dir/ym_info.json" ||\
43 echo "Please run the script in the root of the Nixpkgs repo"