-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgen-docs.sh
More file actions
executable file
·65 lines (53 loc) · 1.74 KB
/
Copy pathgen-docs.sh
File metadata and controls
executable file
·65 lines (53 loc) · 1.74 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/usr/bin/env bash
dir_name=$(dirname "$0")
cd "$dir_name" || exit 1
if [ ! -d docs ]; then
echo "docs directory not found"
exit 1
fi
output_file="docs/available_tools.md"
# Generate the header
echo "Here is a list of available tools that can be installed with self contained variables:" > $output_file
echo "" >> $output_file
find vars -name '*.yml' | sort | grep -v main | while read -r doc
do
echo "Generating docs for $doc"
repo=$(yq '.gh_role_installer_repository' "$doc")
f=$(basename "$doc")
bin_name=$(echo "$f" | cut -d'.' -f1)
(
echo "## ${bin_name}"
echo ""
echo "[Github repository](https://github.com/$repo)"
echo ""
echo '```'
echo "- name: Install ${bin_name}"
echo " hosts: all"
echo " become: true"
echo " tasks:"
echo " - name: \"Install ${bin_name}\""
echo " ansible.builtin.include_role:"
echo " name: sgaunet.gh_role_installer"
echo " vars_from: $f"
echo '```'
) >> $output_file
done
badge_file="docs/badges.md"
echo "# Pipeline status by app" > $badge_file
(
echo ""
echo "Bad status do not indicate that the role won't work. It's often a question of version returned by the utility that is wrong."
echo "Be patient, it will be fixed."
echo ""
) >> $badge_file
find vars -name '*.yml' | sort | grep -v main | while read -r doc
do
echo "Generating badges for $doc"
repo=$(yq '.gh_role_installer_repository' "$doc")
f=$(basename "$doc")
bin_name=$(echo "$f" | cut -d'.' -f1)
(
echo "[](https://github.com/sgaunet/ansible-role-gh-release-installer/actions?query=workflow%3ACI-${bin_name})"
# echo ""
) >> $badge_file
done