From 26c0dccc88dd4df2396efd4b98558bc4d0f1ac94 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Wed, 11 Jul 2018 11:40:51 +0200 Subject: [PATCH] ci: group after success tasks in a single script Signed-off-by: Thierry Bugier --- .travis.yml | 5 ++-- .../push_ghpages.sh => tests/after_success.sh | 23 ++++++++++++++++++- tests/update_locales.sh | 17 -------------- 3 files changed, 24 insertions(+), 21 deletions(-) rename .github/push_ghpages.sh => tests/after_success.sh (70%) delete mode 100755 tests/update_locales.sh diff --git a/.travis.yml b/.travis.yml index c67f5b4e..f357928f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,9 +43,8 @@ script: - if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then vendor/bin/phpcs -p --standard=vendor/glpi-project/coding-standard/GlpiStandard/ *.php install/ inc/ front/ ajax/ tests/; fi after_success: - # let's update the documentation - - if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then tests/update_locales.sh; fi - - if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then .github/push_ghpages.sh; fi + # let's update the documentation and locales + - if [ ${TRAVIS_PHP_VERSION:0:3} == "$CS" ] && [ "$GLPI_BRANCH" = "$AFTER_SUCCESS_BRANCH" ]; then tests/after_success.sh; fi cache: directories: diff --git a/.github/push_ghpages.sh b/tests/after_success.sh similarity index 70% rename from .github/push_ghpages.sh rename to tests/after_success.sh index 29dd4545..e2116230 100755 --- a/.github/push_ghpages.sh +++ b/tests/after_success.sh @@ -1,6 +1,27 @@ #!/bin/sh -# please set the $GH_TOKEN in your travis dashboard +# +# After success script for Travis CI +# + +# please keep tasks strongly separated, +# no matter they have the same if block +# please set $TX_USER and $TX_TOKEN in your travis dashboard +if [ "$TRAVIS_BRANCH" = "develop" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then + echo "updating source language" + sudo apt install transifex-client + echo "[https://www.transifex.com]" > ~/.transifexrc + echo "api_hostname = https://api.transifex.com" >> ~/.transifexrc + echo "hostname = https://www.transifex.com" >> ~/.transifexrc + echo "token = ${TX_TOKEN}" >> ~/.transifexrc + echo "password = ${TX_TOKEN}" >> ~/.transifexrc + echo "username = ${TX_USER}" >> ~/.transifexrc + php vendor/bin/robo locales:send +else + echo "skipping source language update" +fi + +# please set the $GH_TOKEN in your travis dashboard if [ "$TRAVIS_BRANCH" = "develop" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then #wget http://get.sensiolabs.org/sami.phar -O "$HOME/bin/sami.phar" # setup_git only for the main repo and not forks diff --git a/tests/update_locales.sh b/tests/update_locales.sh deleted file mode 100755 index fda09497..00000000 --- a/tests/update_locales.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# please set $TX_USER and $TX_TOKEN in your travis dashboard - -if [ "$TRAVIS_BRANCH" = "develop" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then - # check if gh-pages exist in remote - echo "updating source language" - sudo apt install transifex-client - echo "[https://www.transifex.com]" > ~/.transifexrc - echo "api_hostname = https://api.transifex.com" >> ~/.transifexrc - echo "hostname = https://www.transifex.com" >> ~/.transifexrc - echo "token = ${TX_TOKEN}" >> ~/.transifexrc - echo "password = ${TX_TOKEN}" >> ~/.transifexrc - echo "username = ${TX_USER}" >> ~/.transifexrc - php vendor/bin/robo locales:send -else - echo "skipping source language update" -fi