base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / hy / hyprland / update.sh
bloba7f18bef195140f7d340c18143a98d4201d2a774
1 #!/usr/bin/env nix-shell
2 #! nix-shell -i bash -p common-updater-scripts fd jq
4 set -eou pipefail
6 latest_release="$(curl --silent 'https://api.github.com/repos/hyprwm/Hyprland/releases/latest')"
7 latest_tag="$(curl --silent 'https://api.github.com/repos/hyprwm/Hyprland/tags?per_page=1')"
8 commit_hash="$(jq -r '.[0].commit.sha' <<<"$latest_tag")"
9 latest_commit="$(curl --silent 'https://api.github.com/repos/hyprwm/Hyprland/commits/'"$commit_hash"'')"
10 commit_message="$(jq -r '.commit.message' <<<"$latest_commit")"
12 tag=$(jq -r '.tag_name' <<<"$latest_release")
13 # drop 'v' prefix
14 version="${tag#v}"
16 branch=$(jq -r '.target_commitish' <<<"$latest_release")
18 date=$(jq -r '.created_at' <<<"$latest_release")
19 # truncate time
20 date=${date%T*}
22 # update version; otherwise fail
23 update-source-version hyprland "$version" --ignore-same-hash
25 # set hyprland dir
26 dir="pkgs/by-name/hy/hyprland"
28 echo -e '{
29 "branch": "'"$branch"'",
30 "commit_hash": "'"$commit_hash"'",
31 "commit_message": "'"$commit_message"'",
32 "date": "'"$date"'",
33 "tag": "'"$tag"'"
34 }' >"$dir/info.json" || echo "Please run the script in the root of the Nixpkgs repo"