-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-sources.sh
executable file
·57 lines (46 loc) · 1.2 KB
/
update-sources.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
#!/bin/bash
export TZ="Europe/Berlin"
# Get the directory where the script is located
SCRIPT_DIR=$(dirname "$(realpath "$0")")
SCRIPT_NAME=$(basename "$0")
# Change to the script's directory
cd "$SCRIPT_DIR" || exit 1
# Load the environment variables
if [ -f "$SCRIPT_DIR/.env" ]; then
source "$SCRIPT_DIR/.env"
else
current_time=$(date +"%Y-%m-%d %H:%M:%S")
log_message="$current_time [$SCRIPT_NAME] Environment file not found!"
echo -e "$log_message" >> "$LOGFILE_PATH/webhook.log"
exit 1
fi
build_all=false
# Parse input arguments
for arg in "$@"; do
case $arg in
--all-languages)
build_all=true
shift
;;
*) ;;
esac
done
cd $SPHINX_PATH
git pull
if $build_all; then
bash ./build-locales.sh --all-languages
else
bash ./build-locales.sh
fi
# add language files to git (add, commit and push)
git add ./source ./locales --all
git commit -m "Language Files generated by Sphinx"
git push
# weblate pull
bash trigger_weblatepull.sh $WEBLATE_API_KEY
# trigger deepl
bash trigger_deepl.sh $WEBLATE_API_KEY
# weblate commit (deepl-translated files)
bash trigger_weblatecommit.sh $WEBLATE_API_KEY
# weblate push
bash trigger_weblatepush.sh $WEBLATE_API_KEY