2019-07-10 17:38:59 +01:00
|
|
|
#!/usr/bin/env bash
|
2021-07-16 14:15:31 +01:00
|
|
|
# SPDX-License-Identifier: MIT
|
2019-07-10 17:38:59 +01:00
|
|
|
|
2020-06-09 15:03:35 +01:00
|
|
|
# This script is executed by GitHub Actions for every successful push (on any branch, PR or not).
|
2019-07-10 17:38:59 +01:00
|
|
|
set -ex
|
|
|
|
|
|
|
|
function initialize {
|
|
|
|
if [ -z "$TLDRHOME" ]; then
|
2020-06-09 15:03:35 +01:00
|
|
|
export TLDRHOME=${GITHUB_WORKSPACE:-$(pwd)}
|
2019-07-10 17:38:59 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
export TLDR_ARCHIVE="tldr.zip"
|
|
|
|
}
|
|
|
|
|
|
|
|
function build_index {
|
|
|
|
npm run build-index
|
2021-09-16 04:32:13 +01:00
|
|
|
echo "Pages index successfully built."
|
2019-07-10 17:38:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function build_archive {
|
|
|
|
rm -f "$TLDR_ARCHIVE"
|
|
|
|
cd "$TLDRHOME/"
|
|
|
|
zip -q -r "$TLDR_ARCHIVE" pages* LICENSE.md index.json
|
2021-09-16 04:32:13 +01:00
|
|
|
echo "Pages archive successfully built."
|
2019-07-10 17:38:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
###################################
|
|
|
|
# MAIN
|
|
|
|
###################################
|
|
|
|
|
|
|
|
initialize
|
|
|
|
build_index
|
|
|
|
build_archive
|