mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-29 23:24:55 +02:00
* TravisCI: cleaner deployment process. * TravisCI: rename deployment script.
This commit is contained in:
parent
1e28a0cbc0
commit
d83f446a8c
2 changed files with 20 additions and 22 deletions
18
.travis.yml
18
.travis.yml
|
@ -1,16 +1,14 @@
|
|||
sudo: false
|
||||
language: node_js
|
||||
|
||||
node_js:
|
||||
- stable
|
||||
node_js: stable
|
||||
cache: false
|
||||
|
||||
after_success:
|
||||
- eval "$(ssh-agent -s)"
|
||||
- openssl aes-256-cbc -K $encrypted_973441be79af_key -iv $encrypted_973441be79af_iv -in ./scripts/id_ed25519_tldr_asset_upload.enc -out id_ed25519 -d
|
||||
- chmod 600 id_ed25519
|
||||
- ssh-add id_ed25519
|
||||
- bash scripts/build.sh
|
||||
|
||||
after_failure:
|
||||
- cat test_result | python scripts/send_to_bot.py
|
||||
- python scripts/send_to_bot.py < test_result
|
||||
|
||||
deploy:
|
||||
provider: script
|
||||
script: bash scripts/deploy.sh
|
||||
on:
|
||||
branch: master
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# This script is executed by Travis CI when a PR is merged (i.e. in the `after_success` step).
|
||||
# This script is executed by Travis CI when a PR is merged (i.e. in the `deploy` step).
|
||||
set -ev
|
||||
|
||||
function initialize {
|
||||
|
@ -12,10 +12,17 @@ function initialize {
|
|||
export SITE_URL="github.com/tldr-pages/tldr-pages.github.io"
|
||||
export SITE_REPO_SLUG="tldr-pages/tldr-pages.github.io"
|
||||
|
||||
# Configure git.
|
||||
git config --global user.email "travis@travis-ci.org"
|
||||
git config --global user.name "Travis CI"
|
||||
git config --global push.default simple
|
||||
git config --global diff.zip.textconv "unzip -c -a"
|
||||
|
||||
# Decrypt and add deploy key.
|
||||
eval "$(ssh-agent -s)"
|
||||
openssl aes-256-cbc -K $encrypted_973441be79af_key -iv $encrypted_973441be79af_iv -in ./scripts/id_ed25519_tldr_asset_upload.enc -out id_ed25519 -d
|
||||
chmod 600 id_ed25519
|
||||
ssh-add id_ed25519
|
||||
}
|
||||
|
||||
function rebuild_index {
|
||||
|
@ -24,7 +31,6 @@ function rebuild_index {
|
|||
|
||||
function build_archive {
|
||||
rm -f $TLDR_ARCHIVE
|
||||
|
||||
cd $TLDRHOME/
|
||||
zip -r $TLDR_ARCHIVE pages*/ LICENSE.md
|
||||
}
|
||||
|
@ -44,13 +50,7 @@ function upload_assets {
|
|||
# MAIN
|
||||
###################################
|
||||
|
||||
if [ ! "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
echo "This is a Pull Request, no index rebuild needed"
|
||||
elif [ ! "$TRAVIS_BRANCH" == "master" ]; then
|
||||
echo "This is not a master branch, no index rebuild needed"
|
||||
else
|
||||
initialize
|
||||
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
|
||||
initialize
|
||||
rebuild_index && echo "Rebuilding index done."
|
||||
build_archive && echo "Pages archive created."
|
||||
upload_assets && echo "Assets (pages archive, index) deployed to static site."
|
Loading…
Add table
Reference in a new issue