-
Notifications
You must be signed in to change notification settings - Fork 6
/
create-po.sh
executable file
·79 lines (64 loc) · 1.72 KB
/
create-po.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
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
DIR=$(cd $(dirname $0); pwd)
cd $DIR
DOCS="\
server_installation \
securing_apps \
server_admin \
server_development \
authorization_services \
upgrading \
release_notes"
BUILD_DIR1=$DIR/build1
BUILD_DIR2=$DIR/build2
mkdir -p $BUILD_DIR1
git clone https://github.com/keycloak/keycloak-documentation $BUILD_DIR1
cd $BUILD_DIR1
git fetch --tags
mkdir -p $BUILD_DIR2
git clone https://github.com/keycloak/keycloak $BUILD_DIR2
cd $BUILD_DIR2
git fetch --tags
for version in `ls $DIR/src`; do
if [[ $version != $1 ]]; then
echo "Skipping $version"
continue
fi
# Resolve build dir by the target version
if [[ $version == 1* ]]; then
cd $BUILD_DIR1
echo "Use old repository for $version"
elif [[ "$(echo "$version < 21.1" | bc)" -eq 1 ]]; then
cd $BUILD_DIR1
echo "Use old repository for $version"
else
cd $BUILD_DIR2/docs/documentation
echo "Use new repository for $version"
fi
TAG=`git tag --list "${version}" | sort | tail -n 1`
if [ -z "$TAG" ]; then
TAG=`git tag --list "${version}.*" | sort | tail -n 1`
fi
# Workaround to lock in community released versions
fixed_tag=`grep "^$version " $DIR/lock-version.txt | cut -d' ' -f2`
if [ -n "$fixed_tag" ]; then
TAG=$fixed_tag
echo "Use locked version $version => $TAG"
fi
echo "Checkout $TAG"
git reset --hard && git clean -xf
git checkout $TAG
for docname in $DOCS; do
TARGET=$docname/index.adoc
if [ -f $TARGET ]; then
echo "Build $docname"
asciidoctor \
-b html5 \
-r asciidoctor-i18n \
-a project_buildType=archive \
-a language=$docname \
-a po-directory=$DIR/src/$version/ \
$TARGET
fi
done
done