-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-version.sh
executable file
·80 lines (67 loc) · 1.71 KB
/
update-version.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
cd "$(dirname -- "${BASH_SOURCE[0]}")" || exit
filename="./home/.chezmoidata/versions.yaml"
repos=(
"romkatv/powerlevel10k"
"zsh-users/zsh-autosuggestions"
"zsh-users/zsh-syntax-highlighting"
"MichaelAquilina/zsh-you-should-use"
"junegunn/vim-plug"
"dandavison/delta"
"sharkdp/bat"
"sharkdp/fd"
"junegunn/fzf"
"direnv/direnv"
"BurntSushi/ripgrep"
"lsd-rs/lsd"
"muesli/duf"
"FiloSottile/age"
"tldr-pages/tlrc"
"fatedier/frp"
"bcicen/ctop"
"kubecolor/kubecolor"
"ahmetb/kubectx"
"wagoodman/dive"
"jesseduffield/lazydocker"
"jqlang/jq"
"mikefarah/yq"
"dundee/gdu"
"zu1k/nali"
"alexellis/arkade"
"FiloSottile/mkcert"
"kubernetes-sigs/kind"
"kevwan/tproxy"
"orf/gping"
"mr-karan/doggo"
# extra binaries
"kubernetes/minikube"
"derailed/k9s"
"kubeshark/kubeshark"
"helm/helm"
"txn2/kubefwd"
)
echo "versions:" >$filename
for repo in "${repos[@]}"; do
echo "processing repo: $repo"
echo " # https://github.com/$repo" >>$filename
name=$(echo "$repo" | cut -d '/' -f 2 | tr -d '-')
#version=$(curl -s -L https://api.github.com/repos/$repo/releases/latest | jq '.tag_name' -r | tr -d '[a-z][A-Z] -')
version=$(
gh api \
--method GET \
--header 'Accept: application/vnd.github+json' \
--jq '.tag_name' \
"https://api.github.com/repos/$repo/releases/latest" 2>/dev/null | grep -v 'Not Found' | tr -d '[a-z][A-Z] -'
)
if [[ -z "${version}" ]]; then
version=$(
gh api \
--method GET \
--header 'Accept: application/vnd.github+json' \
--jq '.[0].name' \
"https://api.github.com/repos/$repo/tags" | tr -d '[a-z][A-Z] -'
)
fi
echo " $name: $version" >>$filename
# sleep 1s
done