|
@@ -9,6 +9,10 @@ function initialize {
|
|
|
export TLDRHOME=${GITHUB_WORKSPACE:-$(pwd)}
|
|
|
fi
|
|
|
|
|
|
+ if [ -z "$TLDR_LANG_ARCHIVES_DIRECTORY" ]; then
|
|
|
+ export TLDR_LANG_ARCHIVES_DIRECTORY="${GITHUB_WORKSPACE:-$(pwd)}/language_archives"
|
|
|
+ fi
|
|
|
+
|
|
|
export TLDR_ARCHIVE="tldr.zip"
|
|
|
}
|
|
|
|
|
@@ -24,6 +28,28 @@ function build_archive {
|
|
|
echo "Pages archive successfully built."
|
|
|
}
|
|
|
|
|
|
+function build_translation_archives {
|
|
|
+ local source_directory="$TLDRHOME"
|
|
|
+ local target_directory="$TLDR_LANG_ARCHIVES_DIRECTORY"
|
|
|
+ mkdir -p "$target_directory"
|
|
|
+ rm -f "$target_directory/*"
|
|
|
+
|
|
|
+ for lang_dir in "$source_directory"/pages*; do
|
|
|
+ if [ -d "$lang_dir" ]; then
|
|
|
+ local lang=$(basename "$lang_dir")
|
|
|
+ local archive_name="tldr-$lang.zip"
|
|
|
+
|
|
|
+ # Create the zip archive
|
|
|
+
|
|
|
+ cd "$lang_dir"
|
|
|
+ zip -q -r "$target_directory/$archive_name" .
|
|
|
+ zip -q -j "$target_directory/$archive_name" "$source_directory/LICENSE.md"
|
|
|
+
|
|
|
+ echo "Pages archive of $archive_name successfully created."
|
|
|
+ fi
|
|
|
+ done
|
|
|
+}
|
|
|
+
|
|
|
###################################
|
|
|
# MAIN
|
|
|
###################################
|
|
@@ -31,3 +57,4 @@ function build_archive {
|
|
|
initialize
|
|
|
build_index
|
|
|
build_archive
|
|
|
+build_translation_archives
|