-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
check-versions.sh
executable file
·66 lines (47 loc) · 1.51 KB
/
check-versions.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
#!/bin/bash
set -eu
get_docker_hub_most_recent_image_tag_not_latest() {
local docker_namespace=$1
local docker_repository=$2
local url="https://hub.docker.com/v2/repositories/${docker_namespace}/${docker_repository}/tags"
echo "GET $url"
local docker_tag_latest_version=$(curl -s $url \
| jq -r '[.results[] | select(.name != "latest")] | sort_by(.last_updated)[-1] | .name' | cat)
echo $docker_tag_latest_version
}
get_makefile_variable_value() {
local makefile_path=$1
local variable_name=$2
local variable_token="${variable_name}:="
echo "Searching for $variable_token"
# sed: replace variable name
local variable_value=$(
grep \
"$variable_token" \
"$makefile_path" \
| sed 's/.*=//' \
)
echo $variable_value
}
test_mkdocs_docker() {
echo ''
echo 'Testing mkdocs docker image version...'
local docker_namespace="squidfunk"
local docker_repository="mkdocs-material"
local docker_latest_version=$(
get_docker_hub_most_recent_image_tag_not_latest \
$docker_namespace \
$docker_repository \
)
echo "${docker_latest_version} ... latest tag version on docker hub."
local makefile_path='./makefile'
local makefile_variable_name='docker_image_mkdocs_material_version'
local makefile_docker_mkdocs_material_version=$(
get_makefile_variable_value \
$makefile_path \
$makefile_variable_name \
)
echo "${makefile_docker_mkdocs_material_version} ... makefile version."
echo "source: $makefile_path"
}
test_mkdocs_docker