-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathpublishTutorials.sh
47 lines (41 loc) · 1.26 KB
/
publishTutorials.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
#!/bin/bash
cd playbooks
SPECIFIED_TUTORIALS=()
for dir in */; do SPECIFIED_TUTORIALS+=("${dir::-1}"); done
echo "SPECIFIED_TUTORIALS:\n"
printf "%s\n" "${SPECIFIED_TUTORIALS[@]}"
cd ../repo
ONLINE_TUTORIALS=()
for dir in */; do ONLINE_TUTORIALS+=("${dir::-1}"); done
echo "ONLINE_TUTORIALS:\n"
printf "%s\n" "${ONLINE_TUTORIALS[@]}"
# delete tutorials, which are not specified anymore
for tutorial in "${ONLINE_TUTORIALS[@]}"
do
if [[ ! " ${SPECIFIED_TUTORIALS[@]} " =~ " ${tutorial} " ]]; then
rm -rf "${tutorial}"
echo "deleted ${tutorial} as not specified anymore in tutorials repository"
fi
done
cd ../build/output/katacoda
GENERATED_TUTORIALS=()
for dir in */; do GENERATED_TUTORIALS+=("${dir::-1}"); done
echo "GENERATED_TUTORIALS:\n"
printf "%s\n" "${GENERATED_TUTORIALS[@]}"
cd ../../..
# delete tutorials, which are newly generated
for tutorial in "${ONLINE_TUTORIALS[@]}"
do
if [[ ! " ${GENERATED_TUTORIALS[@]} " =~ " ${tutorial} " ]]; then
rm -rf repo/'${tutorial}'
echo "deleted ${tutorial} as this is up to be replaced by the build"
fi
done
cp -r build/output/katacoda/*/ repo/
cd repo/
git add -A
git config user.email "devonfw"
git config user.name "devonfw"
git commit -m "Updated tutorials"
git pull --rebase origin/master
git push