mirror of
https://github.com/tldr-pages/tldr.git
synced 2024-10-30 16:18:20 +01:00
TravisCI: update secure token, refactor and fix build script to correctly fail on error
This commit is contained in:
parent
eb32b2bd2b
commit
1c0b27edc1
2 changed files with 9 additions and 24 deletions
16
.travis.yml
16
.travis.yml
|
@ -1,19 +1,13 @@
|
|||
sudo: false
|
||||
|
||||
language: ruby
|
||||
|
||||
rvm:
|
||||
- 2.2.2
|
||||
|
||||
- 2.2.2
|
||||
gemfile:
|
||||
- Gemfile
|
||||
|
||||
- Gemfile
|
||||
script:
|
||||
- make check
|
||||
|
||||
- make check
|
||||
after_success:
|
||||
- bash scripts/build.sh
|
||||
|
||||
- bash scripts/build.sh
|
||||
env:
|
||||
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=
|
||||
|
|
|
@ -18,21 +18,16 @@ function initialize {
|
|||
|
||||
function rebuild_index {
|
||||
$TLDRHOME/scripts/build_index.rb
|
||||
echo "Rebuilding index is done"
|
||||
}
|
||||
|
||||
function build_archive {
|
||||
echo "Removing $TLDR_ARCHIVE if it exists"
|
||||
rm -f $TLDR_ARCHIVE
|
||||
|
||||
echo "Creating an archive $TLDR_ARCHIVE"
|
||||
cd $TLDRHOME/
|
||||
zip -r $TLDR_ARCHIVE pages/ LICENSE.md
|
||||
}
|
||||
|
||||
function upload_assets {
|
||||
echo "Uploading assets to static site"
|
||||
|
||||
git clone --quiet --depth 1 https://${GH_TOKEN}@${SITE_URL} $SITE_HOME
|
||||
mv -f $TLDR_ARCHIVE $SITE_HOME/assets/
|
||||
cp -f $TLDRHOME/pages/index.json $SITE_HOME/assets/
|
||||
|
@ -40,11 +35,7 @@ function upload_assets {
|
|||
cd $SITE_HOME
|
||||
git add -A .
|
||||
git commit -m "[TravisCI] uploaded assets after commits ${TRAVIS_COMMIT_RANGE}"
|
||||
if [[ ! `git push -q` ]]; then
|
||||
echo "Cannot push to a static site"
|
||||
else
|
||||
echo "Assets deployed"
|
||||
fi
|
||||
git push -q
|
||||
}
|
||||
|
||||
###################################
|
||||
|
@ -57,7 +48,7 @@ elif [ ! "$TRAVIS_BRANCH" == "master" ]; then
|
|||
echo "This is not a master branch, no index rebuild needed"
|
||||
else
|
||||
initialize
|
||||
rebuild_index
|
||||
build_archive
|
||||
upload_assets
|
||||
rebuild_index && echo "Rebuilding index is done"
|
||||
build_archive && echo "Pages archive is created"
|
||||
upload_assets && echo "Assets (pages archive, index) deployed to static site"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue