tldr/scripts/build.sh

33 lines
644 B
Bash
Raw Normal View History

#!/usr/bin/env bash
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).
set -ex
function initialize {
if [ -z "$TLDRHOME" ]; then
2020-06-09 15:03:35 +01:00
export TLDRHOME=${GITHUB_WORKSPACE:-$(pwd)}
fi
export TLDR_ARCHIVE="tldr.zip"
}
function build_index {
npm run build-index
echo "Pages index succesfully built."
}
function build_archive {
rm -f "$TLDR_ARCHIVE"
cd "$TLDRHOME/"
zip -q -r "$TLDR_ARCHIVE" pages* LICENSE.md index.json
echo "Pages archive succesfully built."
}
###################################
# MAIN
###################################
initialize
build_index
build_archive