1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00

Deploy: run all commands separately to avoid unnoticed errors.

This commit is contained in:
Marco Bonelli 2019-02-04 23:34:33 +01:00 committed by Marco Bonelli
parent 0428b0379a
commit c3772f2345

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# This script is executed by Travis CI when a PR is merged (i.e. in the `deploy` step). # This script is executed by Travis CI when a PR is merged (i.e. in the `deploy` step).
set -ev set -ex
function initialize { function initialize {
if [ -z "$TLDRHOME" ]; then if [ -z "$TLDRHOME" ]; then
@ -27,12 +27,14 @@ function initialize {
function rebuild_index { function rebuild_index {
npm run build-index npm run build-index
echo "Rebuilding index done."
} }
function build_archive { function build_archive {
rm -f $TLDR_ARCHIVE rm -f $TLDR_ARCHIVE
cd $TLDRHOME/ cd $TLDRHOME/
zip -r $TLDR_ARCHIVE pages*/ LICENSE.md zip -r $TLDR_ARCHIVE pages*/ LICENSE.md
echo "Pages archive created."
} }
function upload_assets { function upload_assets {
@ -44,6 +46,8 @@ function upload_assets {
git add -A git add -A
git commit -m "[TravisCI] uploaded assets after commits ${TRAVIS_COMMIT_RANGE}" git commit -m "[TravisCI] uploaded assets after commits ${TRAVIS_COMMIT_RANGE}"
git push -q git push -q
echo "Assets (pages archive, index) deployed to static site."
} }
################################### ###################################
@ -51,6 +55,6 @@ function upload_assets {
################################### ###################################
initialize initialize
rebuild_index && echo "Rebuilding index done." rebuild_index
build_archive && echo "Pages archive created." build_archive
upload_assets && echo "Assets (pages archive, index) deployed to static site." upload_assets