lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 23.05-pre 40 lines 1.8 kB view raw
1#!/usr/bin/env nix-shell 2#!nix-shell -i bash -p common-updater-scripts curl jq nix nix-prefetch-git patchutils 3set -euo pipefail 4 5info() { 6 if [ -t 2 ]; then 7 set -- '\033[32m%s\033[39m\n' "$@" 8 else 9 set -- '%s\n' "$@" 10 fi 11 printf "$@" >&2 12} 13 14nitter_old_version=$(nix-instantiate --eval --strict --json -A nitter.version . | jq -r .) 15nitter_old_rev=$(nix-instantiate --eval --strict --json -A nitter.src.rev . | jq -r .) 16today=$(LANG=C date -u +'%Y-%m-%d') 17 18# use latest commit before today, we should not call the version *today* 19# because there might still be commits coming 20# use the day of the latest commit we picked as version 21commit=$(curl -Sfs "https://api.github.com/repos/zedeus/nitter/compare/$nitter_old_rev~1...master" \ 22 | jq '.commits | map(select(.commit.committer.date < $today) | {sha, date: .commit.committer.date}) | .[-1]' --arg today "$today") 23nitter_new_rev=$(jq -r '.sha' <<< "$commit") 24nitter_new_version="unstable-$(jq -r '.date[0:10]' <<< "$commit")" 25info "latest commit before $today: $nitter_new_rev ($(jq -r '.date' <<< "$commit"))" 26 27if [ "$nitter_new_rev" = "$nitter_old_rev" ]; then 28 info "nitter is up-to-date." 29 exit 30fi 31 32if curl -Sfs "https://github.com/zedeus/nitter/compare/$nitter_old_rev...$nitter_new_rev.patch" \ 33| lsdiff | grep -Fxe 'a/nitter.nimble' -e 'b/nitter.nimble' > /dev/null; then 34 info "nitter.nimble changed, some dependencies probably need updating." 35fi 36 37nitter_new_sha256=$(nix-prefetch-git --rev "$nitter_new_rev" "https://github.com/zedeus/nitter.git" | jq -r .sha256) 38update-source-version nitter "$nitter_new_version" "$nitter_new_sha256" --rev="$nitter_new_rev" 39git commit --all --verbose --message "nitter: $nitter_old_version -> $nitter_new_version" 40info "Updated nitter to $nitter_new_version."