-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathgetVersions.sh
More file actions
executable file
·42 lines (36 loc) · 1.12 KB
/
getVersions.sh
File metadata and controls
executable file
·42 lines (36 loc) · 1.12 KB
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
#!/usr/bin/env bash
START_DIR=`pwd`
if [ ! -d "tmp/wiki" ]
then
mkdir -p ${START_DIR}/tmp/wiki
fi
if [ ! -d "tmp/asterisk" ]
then
mkdir tmp
cd tmp
git clone "https://github.com/asterisk/asterisk"
cd asterisk
else
cd tmp/asterisk
git checkout master --force
git pull origin
fi
cat ${START_DIR}/versions-template.md > ${START_DIR}/tmp/wiki/Asterisk-Version-to-ARI-Version.md
git show-ref --tags | while read tags
do
IFS=' ' read -r -a array <<< "$tags"
# skip 0.x 1.x, 10.x and 11.x
if [ "${array[1]:0:12}" = "refs/tags/0." ] || [ "${array[1]:0:12}" = "refs/tags/1." ] || \
[ "${array[1]:0:13}" = "refs/tags/10." ] || [ "${array[1]:0:13}" = "refs/tags/11." ] || \
[ "${array[1]:0:22}" = "refs/tags/certified/1." ] || [ "${array[1]:0:23}" = "refs/tags/certified/11." ]; then
continue
fi
git checkout ${array[0]} --force > /dev/null 2>&1
echo ${array[1]}
if [ -f "rest-api/resources.json" ]; then
VER=`cat rest-api/resources.json | jq -r '.apiVersion'`
echo ${VER}
echo "| ${array[1]:10} | ${VER} |" >> ${START_DIR}/tmp/wiki/Asterisk-Version-to-ARI-Version.md
fi
done
cd ${START_DIR}