1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2024-10-30 18:17:57 +01:00

TravisCI: update secure token, refactor and fix build script to correctly fail on error

This commit is contained in:
Igor Shubovych 2015-12-05 01:09:18 +02:00
parent eb32b2bd2b
commit 1c0b27edc1
2 changed files with 9 additions and 24 deletions

View file

@ -1,19 +1,13 @@
sudo: false sudo: false
language: ruby language: ruby
rvm: rvm:
- 2.2.2 - 2.2.2
gemfile: gemfile:
- Gemfile - Gemfile
script: script:
- make check - make check
after_success: after_success:
- bash scripts/build.sh - bash scripts/build.sh
env: env:
global: global:
secure: PC9nFPE034jPsF0nUn7phCt0RgVouIvd0HsQkOonNSiElh+pkFyaVvDIsQR8lF4x1AxFjz9Yo3qnNGM3txvOMiNqfReDRINfnpvLDkumCeXuKYNO8XyacTHyxMWp0sZM/YhHhJ8qhroSbNOcYYduSW+fTAoyILieRNg+Wwx7b/rdybVKW7d45GDhjmxvx0/cVhLgghXZr7SRMRh89xrGRkT8vRY7xwlmMs83YRSEcs9pkBrdAfSG/16yOCAQVUS1z10zXk/SsRZlNGKzSWsvb1H/OlkHZpxpnawJhmn2iNIy25acqRdyLwv5Oy5P2sQDBjNenTmiv0JL9v7ks5uNtXaIimvSieLKn/vLmGmW/8ArifqwPpEcL/ZmoCH5SzNrvtO06TfuYPCWGrfLKBxySh4jnza8y8YruKlQfjWDm/o5MmiJWvM1mVtIRozO9hDYZ1EMf4e8qlT7K6Y3alWbl3PqZ/DnLHYIUEvtYv5M0H2Ydtqh5JIWj/XRaNSwwmL4Lpcz3AKavP93N4tYAoGIWO9hkVpwCYz3qNH9dIxQJ7ancj01FWVFqqbLcBLPk8MaQsuFSBZpIz9PTLFdtso/YnviqSu5I7GMsFQdvGY8Mth207dMCVs7DRYe9QCjpboQoiCPY8ckmVYvlYdrDMjnfkhQC/OfZLitVLBe6zyEwTs= - secure: ewQMcFd3wH8IHOeGhIkBr2kAgadONmesv2KB+9bPRCZ5gvtFFwlkCMdPnQBR9Kd3GKC8r+EO0JNNFWOvrDjPYhEHi9Ab26Q/qodwfwne9YloKXT+C48Zrbrj8q7kb/FeMYPev+RMuM96j5E5QyqBVohGP7hC2bpU3mvAhQ2wBCE=

View file

@ -18,21 +18,16 @@ function initialize {
function rebuild_index { function rebuild_index {
$TLDRHOME/scripts/build_index.rb $TLDRHOME/scripts/build_index.rb
echo "Rebuilding index is done"
} }
function build_archive { function build_archive {
echo "Removing $TLDR_ARCHIVE if it exists"
rm -f $TLDR_ARCHIVE rm -f $TLDR_ARCHIVE
echo "Creating an archive $TLDR_ARCHIVE"
cd $TLDRHOME/ cd $TLDRHOME/
zip -r $TLDR_ARCHIVE pages/ LICENSE.md zip -r $TLDR_ARCHIVE pages/ LICENSE.md
} }
function upload_assets { function upload_assets {
echo "Uploading assets to static site"
git clone --quiet --depth 1 https://${GH_TOKEN}@${SITE_URL} $SITE_HOME git clone --quiet --depth 1 https://${GH_TOKEN}@${SITE_URL} $SITE_HOME
mv -f $TLDR_ARCHIVE $SITE_HOME/assets/ mv -f $TLDR_ARCHIVE $SITE_HOME/assets/
cp -f $TLDRHOME/pages/index.json $SITE_HOME/assets/ cp -f $TLDRHOME/pages/index.json $SITE_HOME/assets/
@ -40,11 +35,7 @@ function upload_assets {
cd $SITE_HOME cd $SITE_HOME
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}"
if [[ ! `git push -q` ]]; then git push -q
echo "Cannot push to a static site"
else
echo "Assets deployed"
fi
} }
################################### ###################################
@ -57,7 +48,7 @@ elif [ ! "$TRAVIS_BRANCH" == "master" ]; then
echo "This is not a master branch, no index rebuild needed" echo "This is not a master branch, no index rebuild needed"
else else
initialize initialize
rebuild_index rebuild_index && echo "Rebuilding index is done"
build_archive build_archive && echo "Pages archive is created"
upload_assets upload_assets && echo "Assets (pages archive, index) deployed to static site"
fi fi